Decimal places in answer

More
3 weeks 2 days ago #171635 by jimdavies
jimdavies created the topic: Decimal places in answer
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.

More
3 weeks 2 days ago #171636 by Joffm
Joffm replied the 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
3 weeks 2 days ago #171637 by jimdavies
jimdavies replied the 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
3 weeks 2 days ago #171644 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

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

More
3 weeks 2 days ago - 3 weeks 2 days ago #171662 by Joffm
Joffm replied the 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: 3 weeks 2 days ago by Joffm.

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

More
3 weeks 1 day ago #171693 by jimdavies
jimdavies replied the 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
3 weeks 1 day ago #171695 by jimdavies
jimdavies replied the 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
3 weeks 1 day ago #171699 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

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

More
3 weeks 1 day ago #171727 by Joffm
Joffm replied the 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
3 weeks 20 hours ago #171745 by jimdavies
jimdavies replied the 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!