Multiple choice with comments (numbers only)

Mehr
1 Jahr 1 Woche her #169633 von krosser
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.17 hosted on LS servers, not installed locally.
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
1 Jahr 1 Woche her #169648 von krosser
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.17 hosted on LS servers, not installed locally.
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Jahr 1 Woche her - 1 Jahr 1 Woche her #169680 von krosser
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.17 hosted on LS servers, not installed locally.
Letzte Änderung: 1 Jahr 1 Woche her von krosser.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Jahr 1 Woche her #169685 von krosser
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.17 hosted on LS servers, not installed locally.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha