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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto complete combo / text box

Status
Not open for further replies.

markdt

Technical User
Feb 15, 2006
63
GB
Hi all,

i have an asp page which includes a combo box.
When a value is selected the onchange event displays another value from the database in a text box below. On this page i also have a submit button. My problem is that i want to be able to submit my form to another page other than this one. This only way i seem to be able to get the onchange event workin is keep the action tag pointing at itself, so it posts itself.
Any help would be greatly appreciated.
thanks

heres part of my code:

<form name="frm" method="post" action="entermat.asp">
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Part Code </td>
<td><input name="txtPart" type="text" id="txtPart"></td>
<td>Colour</td>
<td><input name="txtColour" type="text" id="txtColour"></td>
</tr>
<tr>
<td>Description</td>
<td><input name="txtDesc" type="text" id="txtDesc"></td>
<td>Coating</td>
<td><input name="txtCoating" type="text" id="txtCoating"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp; </td>
<td>Hardness</td>
<td><input name="txtHardness" type="text" id="txtHardness"></td>
</tr>
<tr>
<td>Supplier Name</td>
<td><select name="selSupp" id="selSupp" onchange="submit();">
<%
Set oRsSupp=Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT DISTINCT SupplierName FROM tblSupplier ORDER BY SupplierName"
oRsSupp.Open strSQL, ConnString
Response.Write "<OPTION>Please Select...</option>"
Do while not oRsSupp.EOF
if Request.Form("selSupp") = oRsSupp("SupplierName") then 'if this is the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRsSupp ("SupplierName") & "' SELECTED>"
Response.Write oRsSupp("SupplierName") & "</Option>"
oRsSupp.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRsSupp ("SupplierName") & "'>"
Response.Write oRsSupp("SupplierName") & "</Option>"
oRsSupp.MoveNext
end if
loop
%>
</select>
 
I would continue to point the action address to the next page, but use the onChange to first change the action attribute to the current pages address before submitting it. This way the page will submit to the correct address if the user clicks submit or hits enter, but will also repost on the select dropdown to the current page. Something like:
Code:
<select name="selSupp" id="selSupp" onchange="frm.action='thispagename.asp';frm.submit();">

-T

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top