Welcome to the LimeSurvey Community Forum

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

Numeric Response Validation for a comments box

  • x_Dbeethekidd_x
  • x_Dbeethekidd_x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188711 by x_Dbeethekidd_x
Numeric Response Validation for a comments box was created by x_Dbeethekidd_x
Hi All


I've tried to use the manual but it really doesn't make any sense to me in terms of what and where I need to enter the expressions/validations etc to achieve what I'm trying to do

I basically want to enforce a numeric response in the comments box from a multiple choice (unless there is a better question layout to use)

Thanks

DB
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188721 by Joffm
Hi, DB,
well, in my opinion there are other options:
Now the respondent selects an item and then has to enter a numeric value into the comment box?
In an multiple numerical input the respondent only enters the numerical values into the selected cells - others stay empty.
You get the same information: Which item was selected and which value was entered.

But in your case:
You know how this question type is stored in the answer table.
You see it there:


So the question validation equation could be:
The comment box is either empty or the entered value is numeric.
In
manual.limesurvey.org/Expression_Manager...mplemented_functions
you find exactly these two needed functions
  • is_empty: Determine whether a variable is considered to be empty
  • is_numeric: Finds whether a variable is a number or a numeric string

We said "The comment box is either empty or the entered value is numeric."
Meaning:
is_empty(Q1_SQ001comment) OR is_numeric(Q1_SQ001comment)

This you validate for all subquestions:
(is_empty(Q1_SQ001comment) OR is_numeric(Q1_SQ001comment)) AND
(is_empty(Q1_SQ002comment) OR is_numeric(Q1_SQ002comment)) AND
...
(is_empty(Q1_SQ00Xcomment) OR is_numeric(Q1_SQ00Xcomment))

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188731 by Joffm
By the way, here are a few other ways to ask this questions:

built-in




with javascript



Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose