Forums

Simple form field only shows based on drop down choice

lydianp18 29 Jun, 2014
This should be really simple, and I can't get anything to work.

I have a drop down, if they choose "Other" in the drop down it gives them a text field blank to fill in. Both the drop down and the blank have the same field "name" but not "id" (it has to pass to the same field in Sugar CRM so the "name" has to match). (note: I've tried making the "name" different just to see if I can get this to work, and it didn't help)

The form can be seen here: http://www.superlight.com.au/index.php?option=com_chronoforms&tmpl=component&chronoform=contactusNZ-Copy

the code in the Load JS box in the On Load function is:

$(document).ready(function() {
	$('#other_container_div').hide(); //hide field on start
 
	$('#countryid').change(function() {
 
	 var $index = $('#country').index(this);
 
	 if($('#countryid').val() != 'Other') { //if this value is NOT selected
	 $('#other_container_div').hide(); //this field is hidden
	 } 
	 else {
	 $('#other_container_div').show();//else it is shown
 
	 }
        });
 });



thanks
Lydia
This topic is locked and no more replies can be posted.