Forum Moderators: open

Message Too Old, No Replies

Textfield filled after Combo Box selection

         

AlexLee

12:31 am on Feb 21, 2005 (gmt 0)

10+ Year Member



Hi, I have a questions here...

What I want is to use a dropdown menu. It will have data inside and when the user selects the data, it will fill the textfield below with data from database. And the value of the dropdown menu would be selected on the one the user clicks...

Like when you register for Hotmail and the part where you have to select your country... It will bring you to another page with details more connected to your country...

orion_rus

9:43 am on Feb 21, 2005 (gmt 0)

10+ Year Member



But it's mostly not javascript)
Javascript needed here to make submit this form to a server. Then it analize the form and make the vield filled. Then return to this form with filled field. Which u already see. If u want to make it like google u need an iframe but for more compatability better reload a full page

AlexLee

9:50 am on Feb 21, 2005 (gmt 0)

10+ Year Member



But how do I make the combo box stay at the selected value after loading a new page?

I know in Java you can use combobox.selected(arrayNum)
Something like that... Is there something similar in Javascript? I know the 2 are suppose to be different.

rocknbil

5:06 pm on Feb 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



when you return from the server set the submitted option as selected

<option value="1" selected>1</option>

If you're doing it with Javascript,
<form name="myForm">
<select name="whatever"> ....

document.myForm.whatever.selectedIndex = [integer]

Remember select arrays are zero-based, top one is selectedIndex zero.