Hi.
I have a question type number in first. And second I have a radiogroup type question.
I want when fill text number question, second question set default value.
For exm:
Q1: how are old you? (textbox number)
Q2: select your age from list: (not enabled)
1- below 18 years old
2- 18 to 25 years old
3- 26 to 35 years old
4- 36 to 45 years old
5- above 46 years old
I want when enter 32 in textbox, In Question radiogroup selected 3 automatically. Q2 must be not eanbled for user.
How can I do it???
Please see this:
S2a (textbox)
S2b (radiogroup)
choices: [
{value: 1, title: below 25},
{value: 2, title: 25 - 35},
{value: 3, title: 36 - 50},
{value: 4, title: above 50},
]
triggers : [ {type: "setvalue", name: "S2a", operator: "less", value: 25, setToName: "S2b", setValue: "1"}, {type: "setvalue", name: "S2a", operator: "greaterorequal", value: 25, setToName: "S2b", setValue: "2"}, {type: "setvalue", name: "S2a", operator: "lessorequal", value: 35, setToName: "S2b", setValue: "2"}, {type: "setvalue", name: "S2a", operator: "greaterorequal", value: 36, setToName: "S2b", setValue: "3"}, {type: "setvalue", name: "S2a", operator: "lessorequal", value: 50, setToName: "S2b", setValue: "3"}, //this line star * {type: "setvalue", name: "S2a", operator: "greater", value: 50, setToName: "S2b", setValue: "4"}, ]
But I enter every number less than 50, In S2b question set value item 3 (comment star * ). Why???
How can I fix this???
Actually, I want set value with some condition. Can I write complex condition in trigger???
Hello,
Unfortunately we do not support the expression in triggers yet :-( We have it in our TODO list.
The only way to solve your issue - use survey.onValueChanged event: https://surveyjs.io/Documentation/Library/?id=surveymodel#onValueChanged
Will it work for you?
Thank you,
Andrew
Yes.
It work for me. But I have another question about trigger.
I ask it in another ticket.
Thanks.