Conditional Validresponse for Textboxes


Author
Message
kveylet
kveylet
Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)Associate Member (59 reputation)
Group: Forum Members
Posts: 6, Visits: 80
I'm asking questions about how long people have spent on activities (music, for e.g.), and I'm hoping to constrain textbox responses based on their responses to prior questions. I'll paste one example below:

<textbox me2a>
/ caption = "If you answered yes to the previous question, for approximately how many hours a week do you play an instrument?"
/ mask = positiveinteger
/ range = (0,168)
</textbox>

<textbox me2b>
/ caption = "Of these hours, how many hours a week do you spend improvising (rather than playing from memorized or written music)?"
/ mask = positiveinteger
/ range = (0,168)
/ validresponse = (<=me2a)
</textbox>


The "<=me2a" intends to express that someone's response to me2b should be less than their response to me2a. However, this does not make Inquisit happy and I receive error messages about those characters. After a little bit of digging, I couldn't find a simple way to express this with the parameters possible for a textbox item, so I figured I'd ask here for help. Thanks in advance!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
kveylet - 11/7/2020
I'm asking questions about how long people have spent on activities (music, for e.g.), and I'm hoping to constrain textbox responses based on their responses to prior questions. I'll paste one example below:

<textbox me2a>
/ caption = "If you answered yes to the previous question, for approximately how many hours a week do you play an instrument?"
/ mask = positiveinteger
/ range = (0,168)
</textbox>

<textbox me2b>
/ caption = "Of these hours, how many hours a week do you spend improvising (rather than playing from memorized or written music)?"
/ mask = positiveinteger
/ range = (0,168)
/ validresponse = (<=me2a)
</textbox>


The "<=me2a" intends to express that someone's response to me2b should be less than their response to me2a. However, this does not make Inquisit happy and I receive error messages about those characters. After a little bit of digging, I couldn't find a simple way to express this with the parameters possible for a textbox item, so I figured I'd ask here for help. Thanks in advance!

It's not possible in the way you want to do it. What would be possible is repeating the respective page if the response in me2b doesn't satisfy the condition:

<textbox me2a>
/ caption = "If you answered yes to the previous question, for approximately how many hours a week do you play an instrument?"
/ mask = positiveinteger
/ range = (0,168)
</textbox>

<textbox me2b>
/ caption = "Of these hours, how many hours a week do you spend improvising (rather than playing from memorized or written music)?"
/ mask = positiveinteger
/ range = (0,168)
</textbox>

<surveypage example>
/ questions = [1=me2a; 2=me2b]
/ branch = [
    if (!(textbox.me2b.response <= textbox.me2a.response)){
        return surveypage.example;
    }
]
</surveypage>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search