how to locate url after click button?

More
4 years 11 months ago #109478 by iscar
version2.0.when user click button, will go to next question.
in a particular question, i would like user to a url instead of next question.
i add jquery as:
$('#movenextbtn').click(function(){window.location.href="http://www.example.com"});

but it still go to next question.
i think it's because
<button class='submit' type='submit' onclick="javascript:document.limesurvey.move.value = 'movenext';
is onclick should be prior to click()?
how to locate url instead of next question?

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
4 years 11 months ago - 4 years 11 months ago #109487 by DenisChenu
Hi,

Tested in 200.sondages.pro/index.php/survey/index/...31/newtest/Y/lang/en
<script>
$(document).ready(function () {
    $("#movenextbtn").click(function(e){
        if($("#answer{SGQ}").val()==""){
            e.preventDefault();
            window.location.href="http://example.com";
        }else{
            // Do something other, here : default
        }
    });
});
</script>

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 4 years 11 months ago by DenisChenu. Reason: {SQG} to {SGQ}
The following user(s) said Thank You: iscar

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #109489 by iscar
when i input something, it still goto example.com

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #109490 by DenisChenu
Youre rigth: SGQ and not SQG .....

Corrected the link : 200.sondages.pro/index.php/survey/index/...31/newtest/Y/lang/en

With the newtest/Y to anwer to another question (be sure to have the las Expression Manager)

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

Please Log in or Create an account to join the conversation.

More
4 years 3 months ago #117155 by surveyman
Interesting script. I was looking for something like this. Did you just copy/paste the script into the question or question group?

Please Log in or Create an account to join the conversation.

More
4 years 3 months ago #117157 by DenisChenu
In question text or help.
Using SGQ then in question text.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: surveyman

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!