Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Another disable "next" button question

  • Taereian_43648
  • Taereian_43648's Avatar
  • New Member
  • New Member
More
10 years 7 months ago #116175 by Taereian_43648
Replied by Taereian_43648 on topic Another disable "next" button question
Yeah I see your point, is there a way to check if the hidden field is yes.
So I can make all the condition for the hidden fields and show the next button based on its value?
The topic has been locked.
More
10 years 7 months ago #116179 by tpartner
Sorry, I don't understand the question.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Taereian_43648
  • Taereian_43648's Avatar
  • New Member
  • New Member
More
10 years 7 months ago - 10 years 7 months ago #116186 by Taereian_43648
Replied by Taereian_43648 on topic Another disable "next" button question
sorry for that, i'm trying something like this:
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
          // Initially disable the Next/Submit button
               $('#movenextbtn').hide ();
    $('hidden.radio[value="Y"]').click(function(){
                     $('#movenextbtn').show
 
});
});</script>
 

If a hidden radio is Y show the next Button.
Last edit: 10 years 7 months ago by Taereian_43648. Reason: mistake
The topic has been locked.
More
10 years 7 months ago #116187 by tpartner
I still don't get where you're going with this but there is no jQuery "hidden" element, you would need to target the radio specifically with an ID and you have some syntax errors.

Something like this (of course, replacing "answer11111X22X33A1" with the correct ID):

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
 
    $('#movenextbtn, #movesubmitbtn').hide();
 
    if($('#answer11111X22X33A1').is(':checked')) {
      $('#movenextbtn, #movesubmitbtn').show();
    }
 
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
10 years 5 months ago - 10 years 5 months ago #118213 by samarta
Cheers,

I am trying to disable the next button based on a comparison of the values of 2 questions but it simply does not work. (I don't know the correct syntax)

the script is:

<script type="text/javascript" charset="utf-8">
$(document).ready(function() {

$('#movenextbtn').hide();
if(($('#answer858668X1964X50571')- $('#answer858668X1964X50572')) >5')){
$('#movenextbtn').show();
}

});
</script>

The error is in the comparison. I tried if(7>5) and it worked.
Thanks in advance

João
Last edit: 10 years 5 months ago by samarta. Reason: incomplete
The topic has been locked.
More
10 years 5 months ago #118216 by holch
But 7 is bigger than 5, thus it should show the button. So I guess this is correct behaviour...

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
More
10 years 5 months ago #118227 by samarta
Hi,

what i meant is: I've changed the script to
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {

$('#movenextbtn').hide();
if(7>5)
{
$('#movenextbtn').show();
}

});
</script>

And it worked.


My question is if the sintax of the following line is correct:
if(($('#answer858668X1964X50571')- $('#answer858668X1964X50572')) >5'))
{
$('#movenextbtn').show();
}

Because is not working as I expect.



Thanks,

João
The topic has been locked.
More
10 years 5 months ago - 10 years 5 months ago #118232 by tpartner
Try this (assuming the questions are text type):

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
 
    $('#movenextbtn').hide();
 
    if(($('#answer858668X1964X50571').val() - $('#answer858668X1964X50572').val()) >5')) {
      $('#movenextbtn').show();
    }
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 5 months ago by tpartner.
The topic has been locked.
More
10 years 5 months ago #118233 by samarta
Hi ,
anf if the questions are numerical type?

still using .val() ?

Thanks
The topic has been locked.
More
10 years 5 months ago #118234 by tpartner
Yes, numerics also use text type inputs.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: samarta
The topic has been locked.
More
10 years 5 months ago #118237 by samarta
Thank you very much.
The topic has been locked.
More
10 years 5 months ago #118242 by samarta
Hi,

Can get this stuff work.

I made code simplier and still does not work
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {

$('#movenextbtn').hide();
if($('#answer858668X1963X50568').val()>5){
$('#movenextbtn').show();
}
});
</script>

I introuced this code on the source of a question of group (1964) to see if the problem was in putting the source of the same group.

I can't get this working.

I appreciate any help.

I've tried also to if($('#answer858668X1963X50568').val()>5') but the last ' does not closes any previous '


Thanks

João
The topic has been locked.
More
10 years 5 months ago #118243 by Ben_V
I don't know the software version you are using, but you can maybe try a mix JS/EM

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
More
10 years 5 months ago #118244 by tpartner
Do you have the correct identifier for the input ('#answer858668X1963X50568')?

Can you activate a test survey?


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
10 years 5 months ago #118245 by Ben_V

tpartner wrote: Do you have the correct identifier for the input ('#answer858668X1963X50568')?

Sometimes I feel a kind of {nostalgia}...

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose