Deactivate form fields.
I have a a list of text fields for a person's name. Then for each textfield there are 5 other input fields to describe the person.
What I want to do is that when no name for the person is enetered, the fields describing that person will be deactivated.
For exaple I got "Player 1 - Blue, Tall, France"
I got 10 of those but when I just put in names for 4 people, the descriptions for the other 6 still appear.
So, is there a way to deactivate the other form fields if one is left at value=0 ?
<input type="text" name="nameField1" onchange="if (this.value=='') descField1.disabled=true;">
To further improve on M@rco's example:
You can also use that code for the onBlur event (when a user moves focus away from the textbox).
<input type="text" name="FieldOne" onChange="disableBox(this);" />
<input type="text" name="nameField1" onchange="descField1.disabled = (this.value == '') ? true : false;">