Decimal places in answer

More
1 year 2 months ago #171635 by jimdavies
How can I force an answer to be a numerical value with 2 decimal places?

This is the question "Provide the current program scorecard score for the program you manage."
I need the participants to answer 97.95, for example.

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 year 2 months ago #171636 by Joffm
Replied by Joffm on topic Decimal places in answer
Hi,
you can validate the question (numerical) with is_empty(self) OR regexMatch('/^[0-9]+(\.[0-9][0-9])$/',self)

Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171637 by jimdavies
Replied by jimdavies on topic Decimal places in answer
Do I need to add some advanced settings? When I preview the survey it allows me to put in anything, it doesn't force 2 decimals.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171644 by DenisChenu
Replied by DenisChenu on topic Decimal places in answer
Question validation (and you can set the tip)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago - 1 year 2 months ago #171662 by Joffm
Replied by Joffm on topic Decimal places in answer
Hi,

When I preview the survey it allows me to put in anything, it doesn't force 2 decimals.

Yes, you can put in anything - but you cannot proceed.

With this settings:


you will get:






Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 1 year 2 months ago by Joffm.

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171693 by jimdavies
Replied by jimdavies on topic Decimal places in answer
Could you paste in the question validation tip so I can copy and paste it?

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171695 by jimdavies
Replied by jimdavies on topic Decimal places in answer
I added the question validation tip but it's not working like in your screen shots. Attached is what I have for the question and the result I get
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171699 by DenisChenu
Replied by DenisChenu on topic Decimal places in answer
Look at the picture of Joffm please :


you leave the test on Validation : you must remove it from here …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171727 by Joffm
Replied by Joffm on topic Decimal places in answer
Hi,
you put the validation in "validation"; you should have put it into "question validation equation"
and there is a missing quote before the "positive" tip.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: jimdavies

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #171745 by jimdavies
Replied by jimdavies on topic Decimal places in answer
I was able to get it to work on question #3 but it's not working on question #5. When I preview the question it appears to work but when I preview the survey I get a red exclamation mark. I compared the validation code and they appear to match between #3 and #5. Only diff I see is #5 has a condition.
Attachments:

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!