losing form variables (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


dupati1 -> losing form variables (7/27/2005 10:15:38)

ok guys,

let me try to explain whats happening here...

i have page1.asp that has a form and two text fields that user can enter and submit...

ok now i am sending these form variables to page2.asp..no problem here...

now page2.asp has a include file called page3.asp....in page2.asp we call some functions that are available in page3.asp...one of the funtions calls back the page2.asp...

at this point of time i am losing the form variables on page2.asp that i had from page1.asp since page2.asp is being called from the function in a include file(page3.asp) and not from page1.asp

how can i overcome this situation and still retain my form values on page2.asp

thanks in advance




rdouglass -> RE: losing form variables (7/27/2005 10:27:04)

quote:

one of the funtions calls back the page2.asp


Not really sure what you mean by this but if it is form data, have you considered using hidden fields throughout the forms?

For instance, page3 could have fields like:

<input type="hidden" name="sameNameAsOnPage2" value="<%=Request.form("sameNameAsOnPage2")%>">

Then, if you POST back to page 2, your Request.form stuff should collect the field stuff.

Did that make sense at all?

If they're not form field data, how 'bout a cookie?




dupati1 -> RE: losing form variables (7/27/2005 11:11:53)

but in my form on page1.asp, i have the action as page2.asp, then in that case how can i collect form variables on page3.asp??

can i have two actions on one form something like this

<form method="post" action="page2.asp" action="page3.asp">


thanks for your reply




rdouglass -> RE: losing form variables (7/27/2005 11:48:21)

quote:

<form method="post" action="page2.asp" action="page3.asp">


No, you can't do that but you could use the hidden fields on page 2 as well. Then collect them on page 3 to be able to send them back to page 2.

Page 1 has visible form fields.

Page 2 has visible form fields and hidden fields from page 1.

Page 3 has visible form fields and hidden fields from page 1 and page 2. Then if you send back to page 2, you should be able to request the original fields from page 1 (as long as they're being requested and stored in a form on page 2 and 3).

That help any?




dupati1 -> RE: losing form variables (7/27/2005 13:34:19)

page2.asp does not has the form...i just retrieve the form variables from page1.asp...

so i was just wondering how can i have retrieve these values on page3.asp and send them back to page2.asp??

can you please show some sample code...i am sure i can take it from there...




rdouglass -> RE: losing form variables (7/27/2005 13:35:25)

quote:

page2.asp does not has the form...i just retrieve the form variables from page1.asp...


So what data are you sending to page 3?




dupati1 -> RE: losing form variables (7/27/2005 13:49:22)

thats the problem i was trying to explain...what is happening here is...

when the page2.asp is invoked from page1.asp, i have the form variables so page2.asp displays fine without any problem...

but page2.asp has a include file, lets say with a function in it...that page2.asp uses

now on page2.asp when the function is executed, it goes to page3.asp and tries to display the page2.asp, BUT THIS TIME page2.asp IS BEING INVOKED BY page3.asp AND BECAUSE OF THIS THE FORM VARIABLES ARE EMPTY and the page2.asp errors out...





rdouglass -> RE: losing form variables (7/27/2005 14:32:44)

Again I ask:

quote:

So what data are you sending to page 3?


Is it form data, querystring data, what? That will determine how we store and recover the data from page 1.

Or is there no data being sent to page 3?




dupati1 -> RE: losing form variables (7/27/2005 15:00:34)

thanks for helping me on this issue...

page1.asp

it just has a form with two variables...

page2.asp

i retrieve the two variables and build my sql query
that in turn builds a crosstab. works fine because my
sql query is intact and correct..

ok now to build crosstab we are using a function on page2.asp...

lets say it looks something like this

Call objCrossTab.processOnServer(strDSN, strSQL, strCallingFile)

here strCallingFile is page2.asp
and strSQL is the sql query that has the form variables from
page1.asp

now page3.asp has this function processOnServer()

Ok now let me tell you this...if i have the SQL hardcorded without
form variables from page1.asp everything works fine...

but when i have form variables the first time page works fine...
and then i lose my variables...

does that make sense...

Thanks








dupati1 -> RE: losing form variables (7/27/2005 15:02:56)

what i mean to say is that the first the crosstab is built fine when the function is called because SQL query is valid and correct...but when i click any item in the crosstab, it again tries to call this function but this time the query is losing the variables...and the crosstab is not getting constructed...





dupati1 -> RE: losing form variables (7/27/2005 15:11:22)

is there any other way to keep the form variables available to page2.asp whenever it is invoked...

i tried session variables to no avail...i dont why session variables wont work...

can we have a hidden form or as such that can hold these from variables from page1 and submit to page2.asp whenever it is called...

any alternative will work as long as we can get hold of form variables...





rdouglass -> RE: losing form variables (7/27/2005 15:52:53)

How about putting your variables into sessions instead? The other options are a cookie or querystrings.

If they're not too large, that just might do the trick. IOW on page 2 write your 2 variables into sessions. Then use the session values in your query.

Did that make any sense? That would be how I might attempt it.




rdouglass -> RE: losing form variables (7/27/2005 15:53:54)

Oh, I was typing while you were posting. Can you post the relevant code for the pages? AT least the parts where you build your SQL and grab the values?




dupati1 -> RE: losing form variables (7/27/2005 16:40:37)

Here you go:

page2.asp

rowvalue=request.form("row")
colvalue=request.form("col")

strSQL = " SELECT "&rowvalue&", "&colvalue&", EquipNumber FROM vw_sales"

'the below is the function call to create crosstab

Call objCrossTab.processOnServer(strDSN, strSQL, strCallingFile)

and the function routine is in page3.asp

as i said everything works fine if i just hardcode the sql query





dupati1 -> RE: losing form variables (7/27/2005 16:46:46)

this is the article that i am using if that helps any...

http://www.asptoday.com/Content.aspx?id=720

thanks





Spooky -> RE: losing form variables (7/27/2005 17:28:29)

Whats the code for page 1?




dupati1 -> RE: losing form variables (7/28/2005 8:54:34)

Thanks for your reply Spooky, here is my code snippet

page1.asp
<html>
<body>
<%

'recordset object
'connection object
'connection string

'SQL query
%>
<form method="POST" action=SQL-ADO-Client-Or-Server.asp>
  <table>
<tr>
      <td>Column Field:</td>
      <td><select size="1" name="colfield">
      <option>-Select One-</option>

       <% While Not rsObj1.EOF %>
  <option value="<% Response.Write rsObj1("COLUMN_NAME")%>"><%Response.Write rsObj1("COLUMN_NAME")%></option>
<%
  rsObj1.MoveNext
  Wend
  %>
        </select></td>
    </tr>

<tr>
      <td>Row Field:</td>
      <td><select size="1" name="rowfield">
      <option>-Select One-</option>

      
       <% While Not rsObj2.EOF %>
  <option value="<% Response.Write rsObj2("COLUMN_NAME")%>"><%Response.Write rsObj2("COLUMN_NAME")%></option>
<%
  rsObj2.MoveNext

  Wend
  %>
        </select></td>
    </tr>

  
</table>
<input type="submit" value="Submit" name="B1" tabindex="4"><input type="reset" value="Reset" name="B2" tabindex="5"></font></p>

</form>
</body>
</html>

page2.asp

rowvalue=request.form("rowfield") 
colvalue=request.form("colfield") 

strSQL = " SELECT "&rowvalue&", "&colvalue&", EquipNumber FROM vw_sales" 

'the below is the function call to create crosstab 

Call objCrossTab.processOnServer(strDSN, strSQL, strCallingFile) 



page3.asp
we just have the function routine here...


thank you

also look at this..i made this small test below in my page2.asp to see if it only the problem with losing variables...i did the following...

rowvalue=request.form("rowfield")
colvalue=request.form("colfield")

if rowvalue<>"" AND colvalue<>"" then
strSQL = " SELECT "&rowvalue&", "&colvalue&", EquipNumber FROM vw_sales"
else
hardcoded sql query
end if

everything worked fine...crosstab gets build every time i try to drill any item inside it...when it loses variables i get something like SELECT , , EquipNumber FROm vw_sales and crosstab doesnt get build






dupati1 -> RE: losing form variables ( message to Spooky) (7/28/2005 15:38:00)

Spooky,

Please reply to this thread at your convenience.

Thanks so much





Spooky -> RE: losing form variables ( message to Spooky) (7/28/2005 16:37:51)

Do you have an example we can see of the code running (and failing :)




dupati1 -> RE: losing form variables ( message to Spooky) (7/28/2005 16:42:00)

I am just using the code available on this link:

http://www.asptoday.com/Content.aspx?id=720

let me know if you do not have access to it...i can email you the files...also let me know the email address to where i can send it...post the code here would be very lengthy and messy..

thanks in advance





dupati1 -> RE: losing form variables ( message to Spooky) (7/28/2005 17:01:31)

or i will post here if you want me to do so.

Thanks





Spooky -> RE: losing form variables ( message to Spooky) (7/28/2005 17:21:08)

Sorry - I dont have access to that, but perhaps you can PM me the address of the site if you want to keep it out of the forum?




dupati1 -> RE: losing form variables ( message to Spooky) (7/28/2005 20:42:36)

Spooky,

I have sent you an email.

Thanks





Spooky -> RE: losing form variables ( message to Spooky) (7/29/2005 1:36:18)

Havent seen it - where did it go?




dupati1 -> RE: losing form variables ( message to Spooky) (7/29/2005 8:48:06)

i have clicked the email button below your name and details....

let me know if i should resend it...or should i use any other way to send you an email

Thanks




dupati1 -> RE: losing form variables ( message to Spooky) (7/29/2005 8:51:13)

ok i sent it again...this time you should get it

thanks





Spooky -> RE: losing form variables ( message to Spooky) (7/29/2005 9:01:07)

Do you have a working link rather than a download?




dupati1 -> RE: losing form variables ( message to Spooky) (7/29/2005 9:05:00)

oh no...i dont have a link with working example...but i am sure you will find it easy to make it running on any test server you have....





dupati1 -> RE: losing form variables ( message to Spooky) (7/30/2005 17:08:45)

Spooky,

Just let me know if you got a chance to look at the code....

Thanks for your time




dupati1 -> RE: losing form variables ( message to Spooky) (8/1/2005 14:12:55)

Spooky,

Did you get a chance to look at the code...

Thanks so much




Page: [1] 2   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375