Multiple choice with comments (numbers only)

Mehr
4 Monate 1 Woche her #169633 von krosser
krosser erstellte das Thema 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.
Anhang:

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her #169648 von krosser
krosser antwortete auf das Thema: 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.
Anhang:

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her - 4 Monate 1 Woche her #169680 von krosser
krosser antwortete auf das Thema: 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.
Letzte Änderung: 4 Monate 1 Woche her von krosser.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
4 Monate 1 Woche her #169685 von krosser
krosser antwortete auf das Thema: 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.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

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