Add Multiple Min/Max Requirements to Text Entry | XM Community
Skip to main content

Hello,

 

I have a text entry question and would like to add a warning that if the entered number in this field is not between a certain range.

Specifically, I have the following:

        var initial_judgement = parseInt("${q://QID21/ChoiceTextEntryValue}");

        var algorithm_advice = parseInt("${lm://Field/14}");

        var second_judgement = parseInt("${q://QID24/ChoiceTextEntryValue}");

 

The requirements should look like this:

second_judgement < initial_judgement && second_judgement > algorithm_advice

OR second_judgement > initial_judgement && second_judgement < algorithm_advice

 

If these requirements are not met, then I would like to display a warning on the same page as second_judgement is entered. Such that one does not get redirected to the next page but sees the warning and can either change the second_judgement or click next again and then gets redirected.

 

Is this possible?

Hi @anleta ,

Assuming that second _judgement is the present text box , you can apply below custom validation on the present  text box question :
 



Hope this resolves your query😊!!


 


Thank you very much! That is indeed very helpful. Is it then also possible to add the validation that participants can only enter a number?


Thank you very much! That is indeed very helpful. Is it then also possible to add the validation that participants can only enter a number?

Hi @anleta ,

Yes you can add another line of validation in both logic sets and pass a regex to accept number only.

You can pass this regex in a new logic set.
Hope it resolves your query😊!!!
 


Thank you so much, that resolves it! :) 


Leave a Reply