Only show question if user chooses "Other" in Dropdown list

How can I only show a question (in a form) if the user selects the answer “Other/none of the above” in a Dropdown list?

I’m trying to connect a text enter in a databased form to be shown only if the user selects the answer “Other/none of the above” from the dropdown list of the previous question.

Thanks in advance

Hi,

you can use Dropdown onChange event to catch when the value is changed. In the event handler you can toggle visibility of the relevant item.

Here I show and hide # textInput1 component based on the selected value in a dropdown.

export function selection1_onChange(event) {
	if (event.target.value == "Other") {
		$w('#textInput1').show()
	} else {
		$w('#textInput1').hide()
	}
}

Don’t forget to set the relevant initial visibility of the #textInput1.

Here are some articles that you may find useful:

Have fun Wix Coding! :slight_smile:

Hello!

What am I doing incorrectly?

A want to activate #textInput8 (selected in image below) only if #selection2 (in image below “Doenças crônicas”) is answered “Outros” (Other, in Portuguese).

Sorry for the stupid question. I’m only a beginner in coding :frowning:

I see you field is “Visible on load” meaning that initially it will be visible, no matter the value. So, you may want to unselect it for the #textInput8 component.

Please also check, that the selection2_onChange function is correctly assigned to #selection2 element. You can do that in Events section of the properties pane.

If that does not help, you can give me a link to your site and I will check it for you.

It worked! Thanks a loooooooooooooooot!!!

THANK YOU GUYS SOO MUCH THE HELP WAS GREAT!!! STUCK ON THIS FOR 5 DAY AND LUCKILY FOUND THIS THREAD. GOD BLESS YOU GUYS!