HOW to Call JAVASCRIPT on submit button.

More
8 months 3 weeks ago #150714 by manavaahuja07
manavaahuja07 created the topic: HOW to Call JAVASCRIPT on submit button.
I want to call java-script on my submit button of survey.

I found little bit that its is called from here replacements_helper.php but i am not getting where should i put java-script and how to call that things i am new to php and limesurey.

Please Log in to join the conversation.

More
8 months 3 weeks ago #150742 by DenisChenu
DenisChenu replied the topic: HOW to Call JAVASCRIPT on submit button.
You don't need PHP for javascript ...

Look at jquery ....

And remind : the javascript must be done after submitting

Then something like this
$(document).on("click","#limesurveysubmitbtn", function(e){
e.preventDefault();
// Do what you want
}


You can replace too default limesurvey function github.com/LimeSurvey/LimeSurvey/blob/ma...urvey_runtime.js#L85

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
8 months 3 weeks ago - 8 months 3 weeks ago #150765 by manavaahuja07
manavaahuja07 replied the topic: HOW to Call JAVASCRIPT on submit button.
Where should i put this jquery by the way.
Last Edit: 8 months 3 weeks ago by manavaahuja07.

Please Log in to join the conversation.

More
8 months 3 weeks ago #150819 by markusfluer
markusfluer replied the topic: HOW to Call JAVASCRIPT on submit button.
Best to put it in the help-text of a question.
But put it in source code view and inside of script tags.
You also need to be super admin to insert scripts into the question.

Please Log in to join the conversation.

More
8 months 3 weeks ago #150923 by holch
holch replied the topic: HOW to Call JAVASCRIPT on submit button.
Since when do you need to be super admin to use Javacript in a question?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
8 months 2 weeks ago #150935 by markusfluer
markusfluer replied the topic: HOW to Call JAVASCRIPT on submit button.
Current state:
You either need to be SuperAdmin, or have a SuperAdmin deactivate the XSS filter in the settings.

Please Log in to join the conversation.

More
8 months 2 weeks ago #150936 by jelo
jelo replied the topic: HOW to Call JAVASCRIPT on submit button.

markusfluer wrote: deactivate the XSS filter in the settings.

Never worked without activating the XSS filter. That's how every workaround with Javascript started in the old days. Deactivate XSS filter.

Please Log in to join the conversation.

More
8 months 2 weeks ago #150943 by holch
holch replied the topic: HOW to Call JAVASCRIPT on submit button.
Deactivated XSS-Filter, this is what I know. Your post sounded like it is ONLY possible if you are a Superadmin, which made me wonder. So all the same as before.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
8 months 1 week ago #151803 by manavaahuja07
manavaahuja07 replied the topic: HOW to Call JAVASCRIPT on submit button.
OK Its work in my case Pro is sorted out.
But i want to put in "Lime survey code" not in survey que's Script.

So where should i put..?

Please Log in to join the conversation.

More
8 months 1 week ago #151816 by DenisChenu
DenisChenu replied the topic: HOW to Call JAVASCRIPT on submit button.
Best solution : register a script file on all Survey with beforeSurveyPage event.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!