Hi,
I have a form with a drop down that has cities. When I select a city, I want the value selected to be sent to the textbox then the textbox becomes readonly. If I change the city again, the value of the textbox changes and it become read only.
The Drop down is called "City"
The Text is called "textfilled"
Here is the code I wrote. After selecting the city the textfield becomes read only, but the problem is that it is not filled with the city I select. Also, is it possible ot make the field background color grey after the drop down is selected:
<script language="javascript">
function FillBox()
{
document.Form1.textfilled.value=document.Form1.City.value
document.Form1.textfilled.readonly="True"
}
</script>
</head>
<body>
<form method="POST" name="Form1" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
<select size="1" name="City" onChange="JavaScript:FillBox()">
<option selected>Select City</option>
<option>London</option>
<option>Paris</option>
</select></p>
<input type="text" name="textfilled" size=20>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
Thanks
Paulin
I have a form with a drop down that has cities. When I select a city, I want the value selected to be sent to the textbox then the textbox becomes readonly. If I change the city again, the value of the textbox changes and it become read only.
The Drop down is called "City"
The Text is called "textfilled"
Here is the code I wrote. After selecting the city the textfield becomes read only, but the problem is that it is not filled with the city I select. Also, is it possible ot make the field background color grey after the drop down is selected:
<script language="javascript">
function FillBox()
{
document.Form1.textfilled.value=document.Form1.City.value
document.Form1.textfilled.readonly="True"
}
</script>
</head>
<body>
<form method="POST" name="Form1" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>
<select size="1" name="City" onChange="JavaScript:FillBox()">
<option selected>Select City</option>
<option>London</option>
<option>Paris</option>
</select></p>
<input type="text" name="textfilled" size=20>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
Thanks
Paulin