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

list box form submit`

Status
Not open for further replies.

BKer

Programmer
Apr 17, 2001
62
US
I am new to javascript and asp and I am having problems submitting all the objects selected by the user to another page. I have two dependent list boxes and two radio buttons. when the user selects an item from the first list box the second is populated with the pertinent data from a database. I can info through the form without the second list box, butwith two I have to repost the new data to the same page. How can I send the data via a submit button? javascript? any help would be nice. here is my code.

<form name=form method=post action=&quot;agingwo.asp&quot;>
<p><font size=5>Aging Work Order Form</font><br><br>
<P>Sort By</P>
<input type=radio name=sort value=&quot;wo_request_date&quot; checked>Date
<input type=radio name=sort value=&quot;wo_number&quot;>Work Order #<br>

<br><br>Shop<br>

<%
set conn=server.CreateObject(&quot;adodb.connection&quot;)
set objrs=server.CreateObject(&quot;adodb.recordset&quot;)
conn.Open(&quot;DRIVER={Microsoft ODBC for Oracle};SERVER=;UID=;PWD=&quot;)
sql= &quot;select distinct ftr_description, wk_title, wk_start_date, wk_last_name, wk_first_name, wk_id_code from f_trades, f_personnel where wk_ftr_fk = ftr_pk and wk_active = 'YES'&quot;


objRS.Open &quot;select sh_name from f_shops&quot;, conn
if Request(&quot;cboPrimary&quot;) = &quot;&quot; then
shop= objRS(&quot;sh_name&quot;)
else
shop = Request(&quot;cboPrimary&quot;)
end if
%>

<p>
<select name=cboPrimary size=1 onChange=&quot;form.submit();&quot; >
<%while not objRS.EOF
varShop = objRS(&quot;sh_name&quot;)%>
<option value=&quot;<%=varShop%>&quot; <%if shop = varShop then Response.Write &quot; SELECTED&quot;%>><%=objRS(&quot;sh_name&quot;)%>
<% objRS.MoveNext
wend
objRS.Close
objRS.Open &quot;select ftr_description from f_trades, f_shops where ftr_sh_fk = sh_pk and sh_name = '&quot; & shop &&quot;'&quot;, conn
%>
</select>
</p>
<p>
<select name=cboSecondary size=1>
<%while not objRS.EOF
varShop = objRS(&quot;ftr_description&quot;)%>
<option value=&quot;<%=varShop%>&quot;><%=objrs(&quot;ftr_description&quot;)%>
<% objRS.MoveNext
wend
objRS.Close
set objRS.ActiveConnection = nothing
set objRS = nothing
%>
</select><br><br>
<input type=button value=&quot;Go&quot; action=&quot;aging_wo.asp&quot;>
</form>


 
I use that method, also, and here's how I handle it...

The two listboxes belong to one form, and that form's action is the same page -- and each time that a selection is made, a javascript function is called that submits the form so that the other options are calculated --

Each time it reloads, I have ASP code that reads the values of the form, and writes the contents to hidden form variables that belong to a different form on the page... that's the one that has the submit button, and also is the one that points to the other page -- so that the values are really on the page twice -- once for the recursive form, and once for the one that will lead them to the other page...

So when they click submit, it appears that they are submitting the form that they have been making selections from, when in actuality, they are submitting the form that I have been building behind the scenes based on their selections --

Then you just pick up the values on the next page and do what you need to do...

hope this made sense. :)
Paul Prewett
 
Paul thanks for the help, but I don't understand how to save the selections into a variable and then write them to another form on the same page. Do you use the request object. I have only use it on the page that the form points to. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top