Accueil arrow Support arrow Forums
LimeSurvey Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Multiple numeric storing zero as string (1 viewing) (1) Guest
Go to bottom Favoured: 0
TOPIC: Multiple numeric storing zero as string
#21418
lsexton (User)
Fresh Lemon
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Multiple numeric storing zero as string 1 Month, 2 Weeks ago Karma: 0  
Hi there,

I'm a new user of limesurvey and setting up a first online survey - very happy with the content so far, and have made good use of the suggestions in the forum and the manual.

I am trying to validate a multiple numeric question. The first question asks:
'How many total children do you care for'
the second asks:
'How many of these children need additional assistance'

each of these questions are asked of different age bands.

I am wanting to make sure that the answer to the second question is not greater than the first.

To do this, I have set up a Custom_On_Load function (using the workaround section from the manual), and I have it working as long as a numeric value greater than 0 (zero) is entered. If 0 (zero) is entered, it seems to store this value as 'No answer' - i.e. as a string.

Is there a way to store 0 (zero) as the actual number 0 instead of the string?

There may be a workaround with javascript here - my js is a little sketchy. I can use the INSERTANS reference as long as it is either a number or a string, but cannot reference both in the same code.

I have tried to use Multiple short text using the numbers_only too, but seems to get the same result.

Thanks for the help here – I am using version 1.72 (5737).
 
Logged Logged  
  The administrator has disabled public write access.
#21419
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Offline Click here to see the profile of this user
Re:Multiple numeric storing zero as string 1 Month, 2 Weeks ago Karma: 28  
I think at the latest 1.80 RC2 which will be released in about a week numerical input is stored as floating point numbers if this helps you.

Otherwise you have to improve your JS skills
 
Logged Logged  
 
Best regards,
Mazi
______________________
Need help? I can: set up Limesurvey for you / create your survey / implement additional features / design your template / offer premium support -> Contact.
  The administrator has disabled public write access.
#21494
lsexton (User)
Fresh Lemon
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:Multiple numeric storing zero as string 1 Month, 2 Weeks ago Karma: 0  
Thanks for the quick reply Mazi

Is there a way to store 0 (zero) in a multiple numeric type question as the number zero, instead of 'No answer'??

Cheers
Luke
 
Logged Logged  
  The administrator has disabled public write access.
#21495
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Offline Click here to see the profile of this user
Re:Multiple numeric storing zero as string 1 Month, 2 Weeks ago Karma: 28  
Not an easy one. You'll have to modify the source code. Better wait for LS1.80 RC2 and check if these answers are treated different there.
 
Logged Logged  
 
Best regards,
Mazi
______________________
Need help? I can: set up Limesurvey for you / create your survey / implement additional features / design your template / offer premium support -> Contact.
  The administrator has disabled public write access.
Go to top