Support

Home Forums Event Espresso Premium Dependent Questions

Dependent Questions

Posted: November 26, 2013 at 12:08 am


Leesa

November 26, 2013 at 12:08 am

Hi there!
I have questions which are dependent on the answer above….

For example

Do you have travel insurance? Yes/No
If yes, please list your travel insurance information

Is there anyway that I can only have the If yes show if they select yes?

Thank you!

Leesa


Josh

  • Support Staff

November 26, 2013 at 8:04 am

Hi Leesa,

It turns out that Event Espresso doesn’t have a built in way to manage conditional or dependent questions. However, since each question has its own ID a bit of jQuery can be used to hide/show questions based on the answer given for another question.

Here is a code snippet that shows an example of how one question can be hidden then made to appear if the question before it is answered yes:

<script>
jQuery(document).ready(function($){
	
	$("label[for='DROPDOWN_63'],select[name='DROPDOWN_63']").hide(); //the question label and dropdown you want hidden 

	$("select[name='DROPDOWN_62']").change(function(){ //the question that if answered Yes makes the next question display
		var myoptionValue = $("select[name='DROPDOWN_62']").val();
	if (myoptionValue == "Yes") {
		$("label[for='DROPDOWN_63'],select[name='DROPDOWN_63']").show();
	} else {
		$("label[for='DROPDOWN_63'],select[name='DROPDOWN_63']").hide();
	}

	});

});
</script>

The support post ‘Dependent Questions’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso