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

Keeping Values When Refresh Occurs 1

Status
Not open for further replies.

NateUNI

MIS
Jan 3, 2002
132
0
0
US
I have an order form which contains a master form at the top of the page and a detail form (order items) at the bottom of the page. Whenever a item is added to the detail form it refreshes and displays the total items (records) for the order. However when it refreshes it losses the top form data the the user input. Is there any way to store these values and have them also refreshed on the page? Any other suggestions to solve this problem? Thanks
 
I guessing.

I would assume that you would want to make one physical form so you can transmit all the data together to get redisplayed when the screen refreshes.

Kris
 
Unfortunately i can't just make one form, it has to be two, any other ideas on how to solve this problem, Thanks!
 
ok, i think i got most of it figured out, my only other ? is the following, If i have this code

strConnect = "Provider=SQLOLEDB.1;Password=password;Persist Security Info=True;User ID=ID;Initial Catalog=PO;Data Source=SQLSERVER200"

sql_get = "select * from PO_Master where Rnd_Num = '" & Random_Number & "'"
Set con = Server.CreateObject("ADODB.Connection")
con.Open strConnect
con.Execute sql_get

The query will return one record, my ? is how do i set the fields of the returned record into variables? ie. if i have one field, "description" in the return recordset, how to i set it equal to the variable "Desc".

Thanks!!!
 
Something like this:


<%
Dim objConn, objRS, strConnect

strConnect = &quot;Provider=SQEDB.1;Password=password;Persist Security Info=True;User ID=ID;Initial Catalog=PO;Data Source=SQLSERVER200&quot;

Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objConn.Open strConnect

strSQL = &quot;select * from PO_Master where Rnd_Num = '&quot; & Random_Number & &quot;'&quot;
Set objRS = objConn.Execute(strSQL)
%>
<INPUT TYPE=TEXT NAME=&quot;Desc&quot; SIZE=15 VALUE=<%=objRS(&quot;description&quot;)%>>

<%
objRs.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>


Kris
- Conscience is what hurts when everything else feels so good.
 
You mean how do you set the variable 'Desc' equal to the DB field 'Description'?

Dim Desc

Desc = objRS(&quot;Description&quot;)
 
You could do this client-side (in fact, it's necessary). Since only the values inside the form that is submitted are passed, you will need to store the values in the second form from the first form. I would suggest having one form and a hidden field whose value is set dependant on what the user clicks:
Code:
<html>
<body>
<form method=&quot;POST&quot; action=&quot;wherever.asp&quot; name=&quot;frmEverything&quot;>
   <input type=&quot;hidden&quot; name=&quot;hdnAction&quot; value=&quot;&quot;>
   <input type=&quot;text&quot; name=&quot;txtFromTop&quot;>
   <input type=&quot;submit&quot; value=&quot;Submit Top&quot; onClick=&quot;frmEverything.hdnAction.value='submit top'>

<!--- More Stuff Here -->
   <input type=&quot;text&quot; name=&quot;txtOrder1&quot;>
   <input type=&quot;submit&quot; value=&quot;Submit Order&quot; onClick=&quot;frmEverything.hdnAction.value='submit order'>
</form>
</body>
</html>
Then on the next page you just execute the code dependant on the Request.Form(&quot;hdnAction&quot;). If it is necessary to go to differant pages dependant on which form they are submitting, you could do away with the hidden field and do this:
Code:
<html>
<body>
<form method=&quot;POST&quot; action=&quot;orderSubmission.asp&quot; name=&quot;frmEverything&quot;>
   <input type=&quot;text&quot; name=&quot;txtFromTop&quot;>
   <input type=&quot;submit&quot; value=&quot;Submit Top&quot; onClick=&quot;frmEverything.action='topSubmission.asp'>

<!--- More Stuff Here -->
   <input type=&quot;text&quot; name=&quot;txtOrder1&quot;>
   <input type=&quot;submit&quot; value=&quot;Submit Order&quot; onClick=&quot;frmEverything.action='orderSubmission.asp'>
</form>
</body>
</html>
I picked the second link to place in the form by default, but it won't matter ewither way because the submit button they press controls what page the form will be directed to, and you will still have all the form info from both sections available.

Hope that helps,
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
With enough resources, time, and coffee, anything is possible.
 
Thanks i have gotten to page to work, i appriciate all your help, Nate
 
NateUNI,
I am having the same problem here. Can u tell me how u make it work? thanks
 
is this inside a frameset?

is it all one form ?

is it all one page with different forms throught the page?

one aspect you could do is in the top form... onchange for say a text element to update form2 or whatever for a hidden element to pass it across again so you can re-populate the top form with the original data, and vice versa on the other forms to update the top form

then it's just a matter of <input type=text name=&quot;text1&quot; value=&quot;<%=request.form(&quot;text1&quot;)%>&quot;>


hope the info helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top