Hi all how do you display the value of a drop down list in a text field. Example : <select name="destin" id="destin" onchange="getPrice();"> <option value="Dublin 1">Abbey St</option> <option value="Dublin 2">Amiens St</option> <option value="Dublin 3">Capel St</option> </select> I need to display the area code "dublin 1, 2, or 3" in a readonly textfield. Thanks and Top of the morning to ya. I wonder do people actually think the Irish say that.
Try this... <script type="text/javascript"> var Destination={ 1: "Dublin 1", 2: "Dublin 2", 3: "Dublin 3" }; </script> <form> <select name="destin" onchange="p=Destination[this[this.selectedIndex].value]; this.form.areacode.value=(p)?p:'';"> <option value="" selected> </option> <option value="1">Abbey St</option> <option value="2">Amiens St</option> <option value="3">Capel St</option> </select> <input type="text" name="areacode" value="" disabled> </form> Code (markup): You should be able add your call to getPrice(): <select name="destin" onchange="p=objDestination[this[this.selectedIndex].value]; this.form.areacode.value=(p)?p:''; [B][COLOR="Red"]getPrice();[/COLOR][/B]"> Code (markup):