Is there a way to determine the current form element without having to
loop through the array or determining by name? Since the form I am
using integrates with PHP which parses the values as a
multi-dimensional array, the names of the fields are not unique. I
need to set the value of the previous form field from a select box.
It seems that the easiest way would be to determine the elements id
and set the current_id-1.value to this value.
Any ideas?
Example:
<input type="text" name="name[]" value="">
<select name="select"
onchange="document.form.elements[(thisid-1)].value=this.value">
<option value="1">1</option>
<option value="2">2</option>
</select>