I want to have fields automatically fill in depending on what which radio button is selected

I need to have a user select 1 of 3 choices of schools, and then have that school name fill in in several other areas of the form.


Roberta Chock


2 Answers

Voted Best Answer

Second part first; for your school name, you create text fields where it should appear. Make sure that the fields have the same name. With that, any entry to a field with that name will appear in all fields with that name.

One possibility for the radio button is to make their return value correspond to the school name (if only the school name is needed throughout the form).

Then add the following script to each of the radio button occurrences (let's call the field where the school name will appear throughout the document "schoolName":

if (event.target.value != "Off") {
this.getField("schoolName").value = event.target.value ;
} else {
this.getField("schoolName").value = "" ;
}

And that should do it.

Hope this can help.


By Max Wyss   

Brilliant! Works perfectly - thanks so much!


Roberta Chock   


Please specify a reason: