Welcome to the LimeSurvey Community Forum

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

Array (Numbers) -- force integers for numeric input

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 6 days ago #167569 by blocka
I'm using Array (Numbers) to enable the input of a small multi-year budget.

I want to either force rounding up on all numbers inputted when the user exits an input box, or restrict all numeric input to integers only.

Is there a way to do this?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 days ago #167574 by Joffm
Hi, blocka,

two quick ideas:
subquestion validation with

regular expression : is_empty(this) or regexMatch('/^\d{1,5}$/',this)
function "is_int(x)": is_empty(this) or is_int(this)

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: blocka
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 6 days ago #167580 by blocka
Awesome! Both work nicely
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose