Welcome to the LimeSurvey Community Forum

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

Validate multiple short text and add additional info in date question type

More
10 years 1 month ago #123332 by jajas
Dear LS Team,

I have two question type Multiple short text and Date question Type.

Q1. Please mention online shop that you ever buy something.
Note: plesase fill wiht "-" If you don't know the answer
A1.__________________
A2.__________________
A3.__________________
A4.__________________

Q2. When you last time to shop in online shop.[Date question with drop down]
DD MM YYYY

in Q2. I want to make a rule if all input box are filled with "-" the quest will display warning if question in not fill yet.
in Q2. If responden forget the date, the responden have choice "Im forget". So I need additional item, like Other option in radio button
question Type
The topic has been locked.
More
10 years 1 month ago #123341 by tpartner
1) Assuming sub-question codes "SQ001", "SQ002", "SQ003", "SQ004", place something like this in the question text or help section:
Code:
{if(self.sq_SQ001 == '-' OR self.sq_SQ002 == '-' OR self.sq_SQ003 == '-' OR self.sq_SQ004 == '-', 'You have an unanswered item.', '')}

2) Add a multiple-choice question with a single option - "I forget". Then you can use relevance to hide/show the date if the multi-choice is checked. CSS could be used to make the date and multi-choice appear as one.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
10 years 1 month ago #123373 by jajas
Hi tpartner, thanks for quick response.
The message is shown when sub question fill with "-" but it still can move to next page.
How to prevent it when all input box filled with "-"
The topic has been locked.
More
10 years 1 month ago #123386 by tpartner
Oh, you just said "display warning if question in not fill yet", nothing about submitting.

Something like this in the Question Validation field:
Code:
self.sq_SQ001 != '-' AND self.sq_SQ002 != '-' AND self.sq_SQ003 != '-' AND self.sq_SQ004 != '-'

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
10 years 1 month ago #123390 by jajas
Hi Tpartner,
I just tried it. i added this script to question validation field. when i typed "-" in sub question, the input box change to
red background. Then i tried to type "abc" the input box still in red background and cannot submitted.

for your info: in put this script in text box "Validation".

but when i expand then "Advanced Setting" I found input box with label "Sub-question validation equation".

which one i should put the script?
The topic has been locked.
More
10 years 1 month ago #123424 by tpartner
Place it in the " Question validation equation" field.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose