Welcome to the LimeSurvey Community Forum

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

Validate Subquestions?

More
12 years 2 months ago #85375 by Bitbull
Replied by Bitbull on topic Validate Subquestions?
Sorry to dig up this (old) thread, but I've got a serious problem with validation of subquestions. I've attached my survey here (sorry, it's in Dutch, but easy to understand as I've stripped it down to the problematic question).
I really don't see why I can't get past the question (when testing the whole survey, that seems to be impossible, a message keeps popping up). Regular expressions have been validated, everything seems fine with "realtime validation", but impossible to get past the question.
Could you guys please take a look and tell me what I'm doing wrong?
Thanks in advance!
The topic has been locked.
More
12 years 2 months ago #85442 by Bitbull
Replied by Bitbull on topic Validate Subquestions?
Okay, I already found the solution.
Apparently, regular expressions in LimeSurvey need to start & end with / character.
It was possible to notice in the example, but I found it nowhere clearly stated, only here (point 2)
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 2 months ago #85482 by Mazi
Replied by Mazi on topic Validate Subquestions?
If you are missing this information at our manual, please add it there. It's a wiki, everyone can edit it.

You can also post a feature request at our idea tracker to add some JavaScript validation before saving a regular expression. Such a script can check for the first characters and throw an error.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
12 years 2 months ago #85496 by Bitbull
Replied by Bitbull on topic Validate Subquestions?
Okay, I added the note to the wiki page .
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 2 months ago #85510 by Mazi
Replied by Mazi on topic Validate Subquestions?
Thanks for your help.

Feeld free to improve the manua whenever something is missing or not clear.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 1 month ago #86185 by Mazi
Replied by Mazi on topic Validate Subquestions?

debianese wrote: Thanks! But I have another question: How can you localize the error message?
I have to create a survey in german and english. The error message should be in the selected language!

To my kniowledge Limesurvey 2 supports multilingual question attributes at the advanced question settings.

There is also an interesting blog post at www.limesurvey-consulting.com which describes different methods of validating email addresses:
" How to validate email addresses at Limesurvey "

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
8 years 6 months ago #135818 by codelogic
Replied by codelogic on topic Validate Subquestions?

TMSWhite wrote: For 1.92, you can do this:
{if(validation_expression,'',if(LANG=='en','Please enter a valid ....','Bitte antworten ...'))}

For 2.0, I'd recommend making this field one of those that can be translated into multiple languages via the quick translation feature.


"LANG" is not working for me in 2.50+

DenisChenu wrote: Hello,

Can use pseudo class lang too in template.css:

Code:
<span lang="en">'Please enter </span><span lang="de">Bitte antworten</span>

And in template.css
Code:
:lang(en) :lang(de){display:none}
:lang(de) :lang(en){display:none}

Denis


Using this method would you use Javascript to toggle a given language text on if it was currently enabled? If so in Javascript is there a better way to get the language other then looking at the body tag for a class named "lang-??"
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #135823 by holch
Replied by holch on topic Validate Subquestions?
This should be a pure CSS based solution, as you can see.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
8 years 6 months ago #135854 by codelogic
Replied by codelogic on topic Validate Subquestions?

holch wrote: This should be a pure CSS based solution, as you can see.

Your right. Thanks!

My understanding of pseudo classes in CSS was lacking.
The topic has been locked.
More
6 years 6 months ago #168844 by sys
Replied by sys on topic Validate Subquestions?
Hello,
Thank you very much for your contribution. If you do distance learning I'm interested! But I have a problem with this solution: If I answer or not, there is an error message that tells me that I did not answer a question. Can you help me?
here is my code:

(is_empty(271338X244X3855SQ001) or regexMatch('/^[1-9]$|^10$/',271338X244X3855SQ001))
and
(is_empty(271338X244X3855SQ002) or or regexMatch('/^[1-9][0-9]{0,1}$|^10[0-9]$|^11 [0-9]$|^120$/',271338X244X3855SQ002))
{if((is_empty(271338X244X3855SQ001) or regexMatch('/^[1-9]$|^10$/',271338X244X3855SQ001)),'Veuillez vérifier le format de votre réponse. .<br />',' Entrez un nombre d’années valide.<br />')}
{if((is_empty(271338X244X3855SQ002) or regexMatch('/^[1-9][0-9]{0,1}$|^10[0-9]$|^11[0-9]$|^120$/',271338X244X3855SQ002)),'','Entrez un nombre de mois valide.')}

I have another question; can you tell me what's wrong with this code?

(is_empty(271338X245X3882SQ001) or (271338X245X3882SQ001+271338X245X3882SQ002== 271338X245X3881))
{if((is_empty(271338X245X3882SQ001) or (271338X245X3882SQ001+271338X245X3882SQ002==271338X245X3881)),’ Veuillez vérifier le format de votre réponse.’,’Vérifiez la cohérence de vos réponses.’))
Thanks you so much !
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose