Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank txtbox - allow user key in new values or select frm existing rec

Status
Not open for further replies.

omoo

Programmer
May 30, 2005
87
US
I need a blank textbox which allow user to select a list of existing records in the database. But if the desired value is not in the database, the user can key in the new value in the blank textbox. This value is to be inserted into the database. I can use "select" to list the values and use "input" to create the blank textbox but I have problems putting these 2 together as one single box.

I am writing it in ASP but not sure if javascript can be implemented from this script?

Here is my code:

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>
<select name="NAME">
	<%
	sql="select DISTINCT NAME from subdb_subcon_rating"
	Set rs = OraDatabase.Execute(sql)
	response.write ("<option value></option>")
	Do While Not rs.EOF
		IF Request("sc_name") = rs("NAME") THEN
 			response.write ("<option value="""&rs("NAME")&""" selected >"&rs("NAME")&"</option>")
		ELSE
 			response.write ("<option value="""&rs("NAME")&""">"&rs("NAME")&"</option>")
		END IF
	rs.MoveNext
	Loop
	%>
</select>
<input type=VARCHAR2 name="NAME" size="50">
</td></tr>
</table><br>
<input type="submit" name="submit_subcon_ratings_records" value="Submit Ratings Records">
<input type="reset" name="reset" value="Reset">
</form>
 
omoo,

here is my solution, as promised:
note: you will need to pre-fill an array using your ASP code, but once that's done, it should work as you want. let me know if you have any questions.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top