Check out the LimeSurvey source code on GitHub!

Validation Ignored on "Hidden" Questions?

More
6 years 1 month ago - 6 years 1 month ago #55515 by RhythmScout
I have a "hidden" question (Always hide this question = YES) that is populated via the end URL from a previous survey. Everything regarding that works fine. However, I have validation on this hidden question that does not seem to be applied - Is this by design?

noticed I've not posted this in the correct forum...apologies.
Last Edit: 6 years 1 month ago by RhythmScout.

Please Log in to join the conversation.

More
6 years 1 month ago #55606 by Mazi
1. Why do you need the validation if the data for this question is inputted by URL?

2. Does it work fine if the question is not hidden?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 1 month ago - 6 years 1 month ago #55608 by RhythmScout

Mazi wrote: 1. Why do you need the validation if the data for this question is inputted by URL?

I don't "really" need this second round of validation. As you point out, in theory this answer has already been validated when input on the original question (survey A) and passed via end URL to survey B. My intent with re-validating the hidden field is to prevent population if the user has messed with the URL params.

Mazi wrote: 2. Does it work fine if the question is not hidden?

Yes, validates correctly if the question is not hidden.
This is not a huge deal, as it is unlikely that the users of my survey will intentionally modify the url, but you never know.
Last Edit: 6 years 1 month ago by RhythmScout.

Please Log in to join the conversation.

More
6 years 1 month ago #55613 by Mazi
I can only guess why the validation doesn't work for hidden questions. Maybe the validating Javascript code has problems dealing with hidden elements!?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 1 month ago #55716 by DenisChenu
(Always hide this question = YES) offer a possibility to fill some column database, but this question doesn't really exist, it never apear at screen, then it never tested.

You can use something like that in your template.css:
#questionXXX{
  position:absolute;
  left:-999em;
  top:-999em;
}

But there is a problem ith validation, i think the best is to use "condition" for the question.
For condition, it don't work for the question on the same page, but it work for question on next page :).

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).

Please Log in to join the conversation.

More
6 years 4 weeks ago #55887 by timbee

RhythmScout wrote: ... (Always hide this question = YES) ... validation on this hidden question that does not seem to be applied


Apparently when "Always hide this question" is set to Yes, it will not display the question on the page at all. I *thought* it would still output the question html but just set the input type to hidden.

What I did instead, was use jquery to set the question's css style "display:none", so it's in the HTML but not actually rendered in the browser window.

question text example:
<script type="text/javascript">
$(document).ready(function() {
	$("#answer{SGQ}").val(stamp());
	$("#answer{SGQ}").css('display', 'none');
 });
</script>

Please Log in to join the conversation.

More
6 years 4 weeks ago #55888 by timbee
Oh, I forgot ... I added the {SGQ} special replacement myself. It seems to be working well and is useful, especially for javascript actions on the current question. maybe there's another way to reference the SurveyID,GroupID,QuestionID in the question text, but I wasn't able to find it. Any limeSurvey developers think it's a good idea to add this into the main code?

Please Log in to join the conversation.

More
6 years 4 weeks ago - 6 years 4 weeks ago #55892 by RhythmScout

timbee wrote: What I did instead, was use jquery to set the question's css style "display:none", so it's in the HTML but not actually rendered in the browser window.


Thx timbee, I ended up using jquery to hide it. Love how LS uses jquery, makes dom modifications so simple w/o touching the base code.
Last Edit: 6 years 4 weeks ago by RhythmScout.

Please Log in to join the conversation.

More
6 years 4 weeks ago #55893 by timbee
How did you reference the question element in jquery?

Please Log in to join the conversation.

More
6 years 4 weeks ago #55894 by Mazi

timbee wrote: Apparently when "Always hide this question" is set to Yes, it will not display the question on the page at all. I *thought* it would still output the question html but just set the input type to hidden.

In combination with conditions this really is a problem! Please open a ticket at the Bugtracker and...

1. Give as much information as possible

2. Attach your survey. You can mark your ticket "private" so that only the developers will be able to take a look at it.

3. Provide step-by-step instructions how to reproduce the problem.

4. If possible/helpful please provide screenshots

Afterwards please post the link to the Bugtracker so we can follow the progress.

Thanks!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 4 weeks ago #55897 by RhythmScout

timbee wrote: How did you reference the question element in jquery?

Directly by the questionID: $('#answer52939X14X160').hide();
Sry, is that what you're asking?

Please Log in to join the conversation.

More
6 years 4 weeks ago #55899 by timbee

Mazi wrote: In combination with conditions this really is a problem! Please open a ticket at the Bugtracker


Okay, I'll try to get this done tomorrow

Please Log in to join the conversation.

More
6 years 4 weeks ago #55901 by timbee

RhythmScout wrote:

timbee wrote: How did you reference the question element in jquery?

Directly by the questionID: $('#answer52939X14X160').hide();
Sry, is that what you're asking?


yeah that's what I meant. I forgot you can manually put the S,G,Q id in there :)

Please Log in to join the conversation.

More
6 years 4 weeks ago #55962 by timbee

Mazi wrote: Afterwards please post the link to the Bugtracker so we can follow the progress.


bugs.limesurvey.org/view.php?id=4911

Please Log in to join the conversation.

More
6 years 3 weeks ago #56031 by Mazi
Thanks for reporting bugs, we'll look into it!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form