I have the following form with 2 columns in each line. 1st column is a empty text box which allow user to key in text and the 2nd column is a drop-down box which allow user to choose the existing records from database.
I need to copy the selected record from the drop-down box to the empty textbox without submitted the entire form. Because at the end of the form, I have to submit all the text in the textbox together. In the case where the user input a name in the textbox and select a value in the drop-down list, the value in the textbox will be taken.
I need to copy the selected record from the drop-down box to the empty textbox without submitted the entire form. Because at the end of the form, I have to submit all the text in the textbox together. In the case where the user input a name in the textbox and select a value in the drop-down list, the value in the textbox will be taken.
Code:
<form name="insert_subcon_ratings_records" method="Post" action="insert_subcon_ratings_records.asp" onsubmit="return validate_form2(this)">
<table>
<tr><td width=180><font color=red>*</font>Subcontractor Name: </td>
<td><input type=text name=NAME size=50>
<select name="name">
<%
sql1="SELECT DISTINCT NAME from subdb_subcon_rating"
Set rs1 = OraDatabase.Execute(sql1)
response.write ("<option value=""""></option>")
Do While Not rs1.EOF
IF Request("name") = rs1("NAME") THEN
response.write ("<option value="""&rs1("NAME")&""" selected >"&rs1("NAME")&"</option>")
ELSE
response.write ("<option value="""&rs1("NAME")&""">"&rs1("NAME")&"</option>")
END IF
rs1.MoveNext
Loop
%>
</select>
</td></tr>
<tr><td><font color=red>*</font>Year: </td>
<td><input type=text name="YEAR" size="50">
<select name="year">
<%
sql2="SELECT DISTINCT YEAR from subdb_subcon_rating"
Set rs2 = OraDatabase.Execute(sql2)
response.write ("<option value=""""></option>")
Do While Not rs2.EOF
IF Request("year") = rs2("YEAR") THEN
response.write ("<option value="""&rs2("YEAR")&""" selected >"&rs2("YEAR")&"</option>")
ELSE
response.write ("<option value="""&rs2("YEAR")&""">"&rs2("YEAR")&"</option>")
END IF
rs2.MoveNext
Loop
%>
</select>
</td></tr>
<tr><td>Rating/100: </td>
<td><input type=text name="RATING" size="50">
<select name="rating">
<%
sql3="SELECT DISTINCT RATING from subdb_subcon_rating"
Set rs3 = OraDatabase.Execute(sql3)
response.write ("<option value=""""></option>")
Do While Not rs3.EOF
IF Request("rating") = rs3("RATING") THEN
response.write ("<option value="""&rs3("RATING")&""" selected >"&rs3("RATING")&"</option>")
ELSE
response.write ("<option value="""&rs3("RATING")&""">"&rs3("RATING")&"</option>")
END IF
rs3.MoveNext
Loop
%>
</select>
</td></tr>
</table><br>
<input type="submit" name="submit_subcon_ratings_records" value="Submit Ratings Records">
<input type="reset" name="reset" value="Reset">
</form>