Branching from a survey question to an openended or a trial element


Author
Message
Inquisitive
Inquisitive
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 13, Visits: 1

I have now been trying to figure this out for a couple days and it's getting pretty frustrating.  For my demographics, I have 2 extra questions for female participants.  Thus, I want to use branching so that the male pp don't see these questions.  I have tried several different combinations, and so far haven't had any luck.  I either get error messages, or when my expt will run, both the males and females get taken to the female set of questions. 



Is it not possible to branch from a survey question (asking sex of pp) to an openended, trial, or survey element?  The first question that the females will see is a yes/no, so I am flexible with how it is asked (i.e., which element type).  However, I've tried all of the ways now and nothing has worked.



If it helps for me to post the script, I'll do that.  I left it out for now, because it's currently a huge mess from all the attempted (and failed) attempts.



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

Branching and the like (/branch, /skip) works at the <surveypage> level, not at the level of individual question elments <e.g. <radiobuttons>, <checkboxes>, etc.). In your case you'd have one <surveypage> that contains the gender question element. Then /branch to a different <surveypage> containing the follow-up questions if a subject answers 'female':

<surveypage demographics>
/ questions = [1=gender; 2=age]
/ branch = [if(radiobuttons.gender.response=="female")surveypage.femalefollowup]
</surveypage>

<surveypage femalefollowup>
/ questions = [1=stuff]
</surveypage>

<radiobuttons gender>
/ caption = "You are"
/ options = ("female","male")
</radiobuttons>

<textbox age>
/ caption = "Your age"
</textbox>

<textbox stuff>
/ caption = "You should only see this if you indicated 'female':"
</textbox>

<survey mysurvey>
/ pages = [1=demographics]
</survey>

Alternatively, you can use the /skip attribute. I.e. if the subject answers "male", skip the follow-up page:

<surveypage demographics>
/ questions = [1=gender; 2=age]
</surveypage>

<surveypage femalefollowup>
/ skip = [radiobuttons.gender.response=="male"]
/ questions = [1=stuff]
</surveypage>

<radiobuttons gender>
/ caption = "You are"
/ options = ("female","male")
</radiobuttons>

<textbox age>
/ caption = "Your age"
</textbox>

<textbox stuff>
/ caption = "You should only see this if you indicated 'female':"
</textbox>

<survey mysurvey>
/ pages = [1=demographics; 2=femalefollowup]
</survey>

Regards,

~Dave


Edited 3 Years Ago by Dave
Inquisitive
Inquisitive
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 13, Visits: 1

It's now working just as I wanted it to, thanks loads!



One minor thing: for ethics approval, questions must be optional, thus I have required = false.  I'm using the skip option, and for the pp that skip the gender question, they still get the female followup questions.  I want them to skip it as well.  I tried:



/ skip = [radiobuttons.gender.response=="noresponse"]



but that didn't work.  What do I need to enter as the response?


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

/ skip = [radiobuttons.gender.response!="female"]


where != is a logical "not". BTW, that's the only /skip you need as it covers both cases ("male" response or no response).


~Dave


Max
Max
Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)Distinguished Member (4K reputation)
Group: Forum Members
Posts: 16, Visits: 118
Hey Dave,
I used your script and am wondering how to handle the behavior of the back button.
For the case you're male, the femalefollowup page will be skipped and you'll go to the funnybunny page directly. If you then wanna change e.g. your age, you need to go back. By pressing the back button on the funnybunny page you will go to the femalefollowup page. So the / skip = [radiobuttons.gender.response=="male"] condition does not work in the reverse direction, right? How can I also skip the femalefollowup when going back?
ATB
Max

<surveypage demographics>
/ questions = [1=gender; 2=age]
</surveypage>

<surveypage femalefollowup>
/ skip = [radiobuttons.gender.response=="male"]
/ questions = [1=stuff]
</surveypage>

<surveypage funnybunny>
/ questions = [1=stuffpuff]
</surveypage>

<radiobuttons gender>
/ caption = "You are"
/ options = ("female","male")
</radiobuttons>

<textbox age>
/ caption = "Your age"
</textbox>

<textbox stuff>
/ caption = "Because you're a woman, write stuff here:"
</textbox>

<textbox stuffpuff>
/ caption = "and now press the back button to get back to the demographics page…unfortunately it will lead you to the femalefollowup page as a male and female"
</textbox>

<survey mysurvey>
/ pages = [1=demographics; 2=femalefollowup; 3=funnybunny]
</survey>

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
Don't use /skip in this case, use /branch.

<surveypage demographics>
/ branch = [if (radiobuttons.gender.response=="female") surveypage.femalefollowup]
/ questions = [1=gender; 2=age]
</surveypage>

<surveypage femalefollowup>
/ questions = [1=stuff]
</surveypage>

<surveypage funnybunny>
/ questions = [1=stuffpuff]
</surveypage>

<radiobuttons gender>
/ caption = "You are"
/ options = ("female","male")
</radiobuttons>

<textbox age>
/ caption = "Your age"
</textbox>

<textbox stuff>
/ caption = "Because you're a woman, write stuff here:"
</textbox>

<textbox stuffpuff>
/ caption = "and now press the back button to get back to the demographics page…unfortunately it will lead you to the femalefollowup page as a male and female"
</textbox>

<survey mysurvey>
/ pages = [1=demographics; 2=funnybunny]
</survey>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search