Welcome to the LimeSurvey Community Forum

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

Workaround 'Making one (or more) rows of an array mandatory'

More
11 years 5 months ago #120614 by steve_81
Hi guys,

I'm trying to use the workaround for making specific rows of a radio-matrix mandatory:
www.limesurvey.org/manual/Workarounds:_M...f_an_array_mandatory

Similar code found in the forum: www.limesurvey.org/de/forum/can-i-do-thi...-multiple-short-text

My problem is with this built-in disabling-navigation-buttons. I use this line:
Code:
$('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', '');
like in the workaround but the buttons still getting disabled when my condition is false.

Minimal example of the code:
Code:
<script type="text/javascript" charset="utf-8"> // Wait until the document is fully loaded $(document).ready(function() { // Interrupt the submit function $('form#limesurvey').submit(function () { // Override the built-in "disable navigation buttons" feature $('#moveprevbtn, #movenextbtn, #movesubmitbtn').attr('disabled', ''); // The text to appear in the warning element var warningText = 'Exception: Eine oder mehrere Pflichtfragen sind nicht beantwortet worden. Bitte beantworten Sie diese zuerst, um fortzufahren!'; // The question ID var questionID = 858; //here comes a validation with a result SQall true or false. //... //... var SQall = false; if (SQall == false) { alert(warningText); return false; } else { return true; } }); }); </script>


Version: 2.05+ Build 140821

Any suggestions, or is this workaround for another version?

Thanks
Stefan
The topic has been locked.
More
11 years 5 months ago - 11 years 5 months ago #120622 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 11 years 5 months ago by DenisChenu.
The following user(s) said Thank You: steve_81
The topic has been locked.
More
11 years 5 months ago #120648 by steve_81
Wow, perfect.

What a powerful thing validation is :cheer: Works perfect and makes all my javascript unneccessary.

Merci beaucoup
Stefan
The topic has been locked.
More
11 years 5 months ago #120650 by DenisChenu
And you have double validation:
- client side with javascript
- server side with PHP

:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: holch, tpartner

Lime-years ahead

Online-surveys for every purse and purpose