Multiple choice with comments (numbers only)

Plus d'informations
il y a 5 mois 5 jours #169633 par krosser
krosser a créé le sujet : Multiple choice with comments (numbers only)
Hey guys,

I need to make it possible to enter numbers only in comment boxes in a multiple choice question. I have tried to use number validation from the manual in the Question validation equation field, but it hasn't worked.

Number validation
Numbers from 1 to 99999
/^([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9])$/

/^[1-9][0-9]{0,4}$/ does the same as above but should run a little faster




Any ideas on what code should be used?

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 5 jours #169648 par krosser
krosser a répondu au sujet : Multiple choice with comments (numbers only)
Okay, so I've figured out that it should be a much more sophisticated code in the validation equation and also in the tip. But I can't figure out the correct syntax for the validation tip.
For example, for just the first answer option:


(is_empty(Expertise_SQ001comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ001comment.NAOK))

{if((is_empty(Expertise_SQ001comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ001comment.NAOK)), ', 'test message...')}



And I get this



Any ideas guys what should be corrected in the validation tip to make it visible as only "test message"?

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 4 jours - il y a 5 mois 4 jours #169680 par krosser
krosser a répondu au sujet : Multiple choice with comments (numbers only)
Well, I've managed to fix it through trial and error.. So the code should be like this

{if(is_empty(Expertise_SQ001comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ001comment.NAOK), '' , 'Only numbers are allowed')}

But it's only for the first comment box. I haven't figured out the syntax for applying it to other comment boxes yet.

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.
Dernière édition: il y a 5 mois 4 jours par krosser.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 4 jours #169685 par krosser
krosser a répondu au sujet : Multiple choice with comments (numbers only)
Alright, so I've figured it out... and in case someone would need it, here's how I did it.

A screenshot from this example in the manual has helped.

It's basically copying the code for each row and changing subquestions' codes.

So in my case, for the Question validation equation:
(is_empty(Expertise_SQ001comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ001comment.NAOK)) and (is_empty(Expertise_SQ002comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ002comment.NAOK)) and (is_empty(Expertise_SQ003comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ003comment.NAOK)) and (is_empty(Expertise_othercomment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_othercomment.NAOK))

and for the Question validation tip:
{if(is_empty(Expertise_SQ001comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ001comment.NAOK), '' , 'Only numbers are allowed')}
{if(is_empty(Expertise_SQ002comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ002comment.NAOK), '' , 'Only numbers are allowed')}
{if(is_empty(Expertise_SQ003comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_SQ003comment.NAOK), '' , 'Only numbers are allowed')}
{if(is_empty(Expertise_othercomment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', Expertise_othercomment.NAOK), '' , 'Only numbers are allowed')}

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!