Dropdown box to load multiple textbox's

A

astreegz

I am trying to use a dropdown(jump_menu) to populate multiple text box's and
I'm having trouble. I have about 5 text fields for a user to populate,
however, I'd like to preload common users into a dropdown. By selecting
their name it would populate all the fields and be ready to submit. Any
thoughts? This is what I have now but it is obviously only populating the
first field.

<p>
<select size="1" onchange="document.form1,field1.value=this.value" id="id1"
name="D1">
<option value>Select User</option>
<option value="Joe Smith|street|city|state|zip">User 1</option>
<option value="Jane Woman|street|city|state|zip">User 2</option>
<option value="Alex Man|street|city|state|zip">Reception</option>
</select></p>
 
K

Kevin Spencer

document.form1.field1.value = document.form1.D1.optons[1].value;
document.form1.field2.value = document.form1.D1.optons[2].value;
document.form1.field3.value = document.form1.D1.optons[3].value;

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
J

Jon Spivey

Hi,
I assume you want to put name, street in the 2nd box and so on
<script type="text/javascript">
function fillBoxes(f){
var a = f.D1.options[f.D1.options.selectedIndex].value.split("|");
f.field1.value = a[0];
f.field2.value = a[1];
f.field3.value = a[2];
f.field4.value = a[3];
f.field5.value = a[4];
}
</script>
<select size="1" onchange="fillBoxes(this.form);"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top