By Konstantina - 6/1/2015
Hello,
I have two textboxes on a surveypage (among other controls like checkboxes ) and I want to check that if the first textbox is populated with a value, the second one is populated as well. If not, the responses are not valid and the next button shouldn't take you to the next page. I tried to use the isvalid function on the Surveypage but it doesn't work. I saw another much older post that the user was facing the same issue and it was listed as a bug. Was it resolved, should I keep trying to use the isValid on a surveypage?
If not, is it possible to set the required attribute of a textbox dynamically, according to the response of another textbox?
Thank you, Konstantina
|
By Dave - 6/1/2015
What you ought to do is use the /branch attribute instead. I.e., if the 1st textbox is not empty and the 2nd is empty, run the same surveypage again:
<survey mysurvey> / pages = [1=pg1; 2=pg2] / showpagenumbers = false / showbackbutton = false </survey>
<surveypage pg1> / caption = "Page 1" / questions = [1=tb1; 2=tb2] / branch = [if (textbox.tb1.response!="" && textbox.tb2.response=="") surveypage.pg1] </surveypage>
<surveypage pg2> / caption = "Page 2" </surveypage>
<textbox tb1> / required = false </textbox>
<textbox tb2> / required = false </textbox>
|
By Konstantina - 6/1/2015
Thank you very much David!
The thing is that I am reusing the same surveypage keeping all the textboxes and checkboxes the same while I am only changing a caption. Mystructure is more like this:
<expt spelling_test> / blocks = [1=spelling] </expt>
<block spelling> /trials = [1-2=pg1;] </block>
<surveypage pg1> / caption = "Page 1" / questions = [1=tb1; 2=tb2] / branch = [if (textbox.tb1.response!="" && textbox.tb2.response=="") surveypage.pg1] </surveypage>
<surveypage pg2> / caption = "Page 2" </surveypage>
<textbox tb1> / required = false </textbox>
<textbox tb2> / required = false </textbox>
When I apply the code suggested the textboxes are reset after the branching. Is there anything you can suggest in order to prevent that?
Your help is much appreciated!
Thanks, Konstantina
|
By Dave - 6/1/2015
No, if you run the <surveypage>s via a <block> instead of a <survey>, there is no way to prevent them from resetting, I'm afraid.
|
By Konstantina - 6/1/2015
Thanks Dave! Also, just to confirm- the isvalid attribute doesn't work with surveypages. Is that correct?
|
By Dave - 6/1/2015
Yes, that is correct.
|
|