Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Re: Form Validation with redirect - Lost field value - Please Help


Message #1 by "Kat" <klbond@n...> on Wed, 13 Mar 2002 00:36:20
Everyone,



The variable code solution I just tried works on my pc but it's an 

unknown if all pcs will have javascript enabled.  Also I haven't gotton 

to the chapter on cookies in my book yet.  But since they can be 

enabled/disabled I don't think I'll try using them for this query.



I'm going to try using encode based on the good examples you've shown me 

here.



I really appreciate all of you sharing your knowledge on the plus/minus 

to the possible solutions and I'll be back to let you know if I get the 

code working.  Actually I'll be back looking for help if I can't figure 

it out :)



Oh also earlier when I said I'd like to hide or remove the string info 

that appends to the http address it was only for appearance reasons and 

just seemed easier to read the address without it there.



Thanks,  Kat







> I have found them easy to depending on the situation, with this It seems

> like if you store the invoice number in a cookie or session you might

> run into problems if the user moves on to a different invoice number, I

> guess I would say it could get a little dicey, unless of course Kat can

> clear the cookie immediately upon returning to the form, say storing it

> in a local variable after the processing is done. I guess all I wanted

> to say was WARE the cookie! 

> 

> The problems I ran into were more related to constant changes of the

> cookie, and I think it may have been something on the user side or even

> in the way cookies work, it seemed like every so often the cookie wasn't

> getting the changes I told it and would use an older value. And this

> only happened after say 20-25 changes in the cookie. I cleared it up by

> moving to a session variable, which seemed to work.

> 

> 

> -----Original Message-----

> From: Peter Foti (PeterF) [mailto:PeterF@S...] 

> Sent: Tuesday, March 12, 2002 3:22 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - Lost fiel d

> value - Please Help

> 

> I believe Kat wanted the value to NOT be displayed in the query string.

> I'm not sure why.

> 

> I find session variables very easy to keep track of.  Depends on the way

> they are being used I suppose.  The problem I found with using the query

> string was that when you have an error message being displayed, hitting

> refresh will reload the page with the error, which is often NOT the best

> thing to happen.  It also makes bookmarking pages an issue because you

> are bookmarking them with specific values loaded, and again, this is

> often NOT the best thing to happen (although I'm thinking more in terms

> of a shopping cart application).  With cookies/session variables, it

> doesn't matter if they go to other pages... the value is still stored as

> long as the session doesn't end (unless you specifically tell it to wipe

> the value).

> 

> Pete

> 

> > -----Original Message-----

> > From: Patrick Sullivan [mailto:pat@s...]

> > Sent: Tuesday, March 12, 2002 3:52 PM

> > To: ASP Databases

> > Subject: [asp_databases] Re: Form Validation with redirect - 

> > Lost field

> > value - Please Help

> > 

> > 

> > You could take the session variable to do this or even a 

> > simple cookie,

> > however, the user will need to have cookies enabled, best is 

> > to use the

> > querystring though. Cookies and sessions can get hard to track so I

> > would say not to use them to store the invnum on your redirect, you

> > never know what could happen, what if its like the 3rd on they are on?

> > I've done something similar to this and I really was just 

> > wasting time,

> > It turned out to be more problematic than I thought. I eventually

> > changed it to a querystring variable and all my problems disappeared.

> > 

> > -----Original Message-----

> > From: Kat [mailto:klbond@n...] 

> > Sent: Tuesday, March 12, 2002 2:32 PM

> > To: ASP Databases

> > Subject: [asp_databases] Re: Form Validation with redirect - 

> > Lost field

> > value - Please Help

> > 

> > Mark and Pete,

> > 

> > Thanks to both of you for your good suggestions.  I used the 

> > code Mark 

> > suggested to pass a variable back to the form for invnum and now the 

> > problem is solved.  I'll try the urlencode too so I can 

> > understand both 

> > ways.

> > 

> > Another quick question - is there a way to keep the string 

> > from showing

> > in 

> > the http: address in the browser?

> > 

> > 

> > I'm new at this (I've programmed mainframe systems for years).  I'm 

> > reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

> > Programmers reference.

> > 

> > I have several different database queries to develop so I'm 

> > sure I'll be

> > 

> > back here later with more questions.

> > 

> > Again, thanks Mark and Pete,

> >     

> >    Kat

> > 

> > 




> > $subst('Email.Unsub').

> > 

> > 

> > 




> > $subst('Email.Unsub').

> > 

> 




> $subst('Email.Unsub').

> 

> 

Message #2 by "Kat" <klbond@n...> on Tue, 12 Mar 2002 00:24:06
Mark,



This is the first query I've tried to create and I'm second guessing 

myself on whether it should be done this way.  Anyway, when inv001r 

redirects back to form1.asp because invnum doesn't exist in the database, 

the form1.asp form field box which contains =Request("invnum") is blank.



Instead of trying to reshow the original form1 page with the error 

message there, maybe I should show the error message in the inv001r.asp 

which queries the database along with a form field to enter another 

invnum, which could be used to reissue the inv001r again.  Would this 

make sense?



Thanks, Kat







> Is the value of invnum blank in the querystring or the

> form?

> 

> Mark.

> --- Kat <klbond@n...> wrote:

> > Mark,

> > 

> > My redirect to inv001R.asp is receiving the invnum

> > value like it should 

> > (in the Case logic at the bottom of form1.asp).

> > 

> > In inv001R, if the invnum wasn't found in the

> > database, I redirect back to 

> > form1.asp but my invnum field in the form1 is now

> > blank.  I used 

> > =Request.Form("invnum") as the form field data. 

> > Isn't this supposed to 

> > retain it's value?.  I also tried

> > =Request("invnum").

> > 

> > Here's the code in inv001R.asp redirecting back to

> > form1.  I didn't think 

> > I had to pass invnum back to form1 since I used

> > =Request in the field.

> > 

> > 

> > Set oRSp = objConn.Execute (sSQL)

> > If oRSp.EOF then

> >    sMSG = "INV Number Does Not Exist"

> >    Response.Redirect("form1.asp?sMSG=" & sMSG)

> > else

> >    sMSG = ""

> > end if

> > 

> > Thanks,  Kat 

> > 

> > > Kat,

> > > 

> > > When you first grab the invnum, store it in a

> > > variable:

> > > 

> > > strInvNum = request("invnum")

> > > 

> > > Then, when you redirect, do this:

> > > 

> > > Response.Redirect("inv001R.asp?invnum=" &

> > strInvNum)

> > > 

> > > Mark.

> > > 

> > > 

> > > --- Kat <klbond@n...> wrote:

> > > > I have a simple asp query form named form1.asp

> > where

> > > > the user keys the 

> > > > invnum.  A redirect to inv001r.asp or

> > inv001r2.asp

> > > > is based on the radio 

> > > > button selected.  Then inv001r (or r2) selects

> > > > fields from a database 

> > > > based on invnum and displays them in table

> > format.

> > > > 

> > > > If the invnum isn't found in the database (I

> > check

> > > > for If rs.eof) I 

> > > > response.redirect back to the form1.asp.

> > > > 

> > > > The problem is the invnum value in the form

> > field is

> > > > wiped out (blank) on 

> > > > the return to form1.

> > > > 

> > > > I thought =Request.Form("invnum") should retain

> > the

> > > > value.  Does anyone 

> > > > see what went wrong?

> > > > 

> > > > Thanks,  Kat 

> > > >   

> > > > 

> > > > <%@ Language=VBScript %>

> > > > <% Response.Buffer = True %>

> > > > <% sMSG = trim(request.querystring("sMSG")) %>

> > > > 

> > > > <html>

> > > > <head>

> > > > <title>New Page 1</title>

> > > > </head>

> > > > <body>

> > > > <h1>My Form Example</h1>

> > > > <p></p>

> > > > <% Response.Write "<p></p><table><tr><td>" &

> > sMSG &

> > > > "</td></tr></table>" %>

> > > > 

> > > > <form action 

> > > > "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> > > > method="post">

> > > > <table border="0" cellspacing="0"

> > > > width="100%"><tr><td 

> > > > width="100%"><hr></td></tr></table>

> > > > <br>

> > > > <table border="0" cellspacing="0" width="100%"

> > > > cellpadding="0"><tr><td 

> > > > width="100%" valign="bottom">

> > > > <h3>Inquiry by Inv</h3></td></tr></table>

> > > > 

> > > > <table>

> > > > <tr><td>Inv Number &nbsp;</td><td><input

> > type=text

> > > > name=invnum value="<%

> > > > =Request.Form("invnum")%>"><input type=submit

> > > > name=btnSubmit 

> > > > value=search></td</tr>

> > > > <tr><td>&nbsp; </td></tr>

> > > > <tr><td>&nbsp; </td><td><input type="radio"

> > > > name="page" value 

> > > > = "invstruct" checked>&nbsp; View the Structure

> > for

> > > > INV</td></tr>

> > > > <tr><td>&nbsp; </td><td><input type="radio"

> > > > name="page" value 

> > > > = "budact">&nbsp; Departments Showing Budget and

> > > > Actual Dollars</td></tr>

> > > > </table>

> > > > 

> > > > <table border="0" cellspacing="0" width="100%"

> > > > cellpadding="0"><tr><td 

> > > > width="100%"><hr></td></tr></table>

> > > > <p></p>

> > > > </form>

> > > > 

> > > > <p></p>

> > > > </body>

> > > > </html>

> > > > 

> > > > <%

> > > > strURL = Request.Form("page")

> > > > Select Case lcase(strURL)

> > > > Case "invstruct"

> > > > Response.Redirect("inv001R.asp?invnum=" &

> > > > Request("invnum"))

> > > > Case "budact"

> > > > Response.Redirect("inv001R2.asp?invnum=" &

> > > > Request("invnum"))

> > > > End Select

> > > > %>

> > > >  





> > > $subst('Email.Unsub').

> > > 

> > > 

> > > __________________________________________________

> > > Do You Yahoo!?

> > > Try FREE Yahoo! Mail - the world's greatest free

> > email!

> > > http://mail.yahoo.com/

> > 





> $subst('Email.Unsub').

> 

> 

> __________________________________________________

> Do You Yahoo!?

> Try FREE Yahoo! Mail - the world's greatest free email!

> http://mail.yahoo.com/

Message #3 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 12 Mar 2002 16:22:00 -0500
I believe Kat wanted the value to NOT be displayed in the query string.

I'm not sure why.



I find session variables very easy to keep track of.  Depends on the way

they are being used I suppose.  The problem I found with using the query

string was that when you have an error message being displayed, hitting

refresh will reload the page with the error, which is often NOT the best

thing to happen.  It also makes bookmarking pages an issue because you

are bookmarking them with specific values loaded, and again, this is

often NOT the best thing to happen (although I'm thinking more in terms

of a shopping cart application).  With cookies/session variables, it

doesn't matter if they go to other pages... the value is still stored as

long as the session doesn't end (unless you specifically tell it to wipe

the value).



Pete



> -----Original Message-----

> From: Patrick Sullivan [mailto:pat@s...]

> Sent: Tuesday, March 12, 2002 3:52 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> 

> You could take the session variable to do this or even a 

> simple cookie,

> however, the user will need to have cookies enabled, best is 

> to use the

> querystring though. Cookies and sessions can get hard to track so I

> would say not to use them to store the invnum on your redirect, you

> never know what could happen, what if its like the 3rd on they are on?

> I've done something similar to this and I really was just 

> wasting time,

> It turned out to be more problematic than I thought. I eventually

> changed it to a querystring variable and all my problems disappeared.

> 

> -----Original Message-----

> From: Kat [mailto:klbond@n...] 

> Sent: Tuesday, March 12, 2002 2:32 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> Mark and Pete,

> 

> Thanks to both of you for your good suggestions.  I used the 

> code Mark 

> suggested to pass a variable back to the form for invnum and now the 

> problem is solved.  I'll try the urlencode too so I can 

> understand both 

> ways.

> 

> Another quick question - is there a way to keep the string 

> from showing

> in 

> the http: address in the browser?

> 

> 

> I'm new at this (I've programmed mainframe systems for years).  I'm 

> reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

> Programmers reference.

> 

> I have several different database queries to develop so I'm 

> sure I'll be

> 

> back here later with more questions.

> 

> Again, thanks Mark and Pete,

>     

>    Kat

> 

> 




> $subst('Email.Unsub').

> 

> 

> 




> $subst('Email.Unsub').

> 

Message #4 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 12 Mar 2002 15:23:43 -0500
Hi Kat,



Ok, that's fine... so use your form code for submitting (although it's

not the way I would do it), and use the check for ERROR_STR that I

added.  Then add the stuff that I listed for inv001r.asp to both

inv001r.asp and inv001r2.asp.



Pete



> -----Original Message-----

> From: Kat [mailto:klbond@n...]

> Sent: Tuesday, March 12, 2002 7:05 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost fiel-

> d value - Please Help

> 

> 

> Pete,

> 

> I'll try the code you're suggesting but the problem is my 

> form doesn't 

> redirect to one page (inv001r.asp).

> 

> Notice the code in my form at the bottom of my original 

> message in this 

> thread, I check the radio buttons to determine which form to 

> redirect to.  

> This is because inv001r selects different fields and uses 

> different tables 

> in the database than inv001r2 does.

> 

> So I can't make form1's form action be to inv001r always.

> 

> Thanks,  Kat

> 

> 

> 

> > Hi Kat,

> > 

> > If it were me, I would redirect the user back to the first 

> page, pass in

> > the form value through the query string, and give an error 

> on that page.

> > I would not put the error on your processing page 

> (inv001r.asp).  And

> > Mark's solution has one big caveat.  If the user has Javascript

> > disabled, they will never be redirected back.  You are mixing server

> > side processing with client side, and it's not a reliable approach.

> > 

> > Here's how I would do it:

> > 

> > 

> > form1.asp

> > 

> > <form action="inv001r.asp" method="post">

> > <%

> >    ' Check for error message

> >    If Len(Session("ERROR_STR")) > 0 Then

> >       Response.Write("<div class=""ErrMessage"">")

> >       Response.Write(Server.HTMLEncode(Session("ERROR_STR")))

> >       Response.Write("</div>")

> > 

> >       ' Clear the ERROR_STR

> >       Session("ERROR_STR") = ""

> >    End If

> > 

> >    Response.Write("<input type=""text"" name=""invnum"" value=""" &

> > Server.HTMLEncode(Request("invnum")) & """>")

> >    

> > %>

> > </form>

> > 

> > 

> > 

> > inv001r.asp

> > ' Do your check for EOF

> > ' If not found, set ERROR_STR session variable

> > ' and redirect user back to form

> > 

> > Session("ERROR_STR") = "INVNUM was not found."

> > Response.Redirect("form1.asp?invnum=" &

> > Server.URLEncode(Request.Form("invnum")) )

> > 

> > 

> > Something like this should solve your problem (I think) and 

> doesn't add

> > the dependency that the client has Javascript enabled.

> > Regards,

> > Pete

> > 

> > 

> > 

> > > -----Original Message-----

> > > From: Kat [mailto:klbond@n...]

> > > Sent: Tuesday, March 12, 2002 2:32 PM

> > > To: ASP Databases

> > > Subject: [asp_databases] Re: Form Validation with redirect - 

> > > Lost field

> > > value - Please Help

> > > 

> > > 

> > > Mark and Pete,

> > > 

> > > Thanks to both of you for your good suggestions.  I used the 

> > > code Mark 

> > > suggested to pass a variable back to the form for invnum 

> and now the 

> > > problem is solved.  I'll try the urlencode too so I can 

> > > understand both 

> > > ways.

> > > 

> > > Another quick question - is there a way to keep the string 

> > > from showing in 

> > > the http: address in the browser?

> > > 

> > > 

> > > I'm new at this (I've programmed mainframe systems for 

> years).  I'm 

> > > reading Wrox Beginning ASP Databases and just ordered 

> Wrox ASP 3.0 

> > > Programmers reference.

> > > 

> > > I have several different database queries to develop so I'm 

> > > sure I'll be 

> > > back here later with more questions.

> > > 

> > > Again, thanks Mark and Pete,

> > >     

> > >    Kat

> > > 

> > > 




> > > $subst('Email.Unsub').

> > > 

> 




> $subst('Email.Unsub').

> 

Message #5 by "Patrick Sullivan" <pat@s...> on Tue, 12 Mar 2002 15:39:42 -0600
I have found them easy to depending on the situation, with this It seems

like if you store the invoice number in a cookie or session you might

run into problems if the user moves on to a different invoice number, I

guess I would say it could get a little dicey, unless of course Kat can

clear the cookie immediately upon returning to the form, say storing it

in a local variable after the processing is done. I guess all I wanted

to say was WARE the cookie! 



The problems I ran into were more related to constant changes of the

cookie, and I think it may have been something on the user side or even

in the way cookies work, it seemed like every so often the cookie wasn't

getting the changes I told it and would use an older value. And this

only happened after say 20-25 changes in the cookie. I cleared it up by

moving to a session variable, which seemed to work.





-----Original Message-----

From: Peter Foti (PeterF) [mailto:PeterF@S...] 

Sent: Tuesday, March 12, 2002 3:22 PM

To: ASP Databases

Subject: [asp_databases] Re: Form Validation with redirect - Lost fiel d

value - Please Help



I believe Kat wanted the value to NOT be displayed in the query string.

I'm not sure why.



I find session variables very easy to keep track of.  Depends on the way

they are being used I suppose.  The problem I found with using the query

string was that when you have an error message being displayed, hitting

refresh will reload the page with the error, which is often NOT the best

thing to happen.  It also makes bookmarking pages an issue because you

are bookmarking them with specific values loaded, and again, this is

often NOT the best thing to happen (although I'm thinking more in terms

of a shopping cart application).  With cookies/session variables, it

doesn't matter if they go to other pages... the value is still stored as

long as the session doesn't end (unless you specifically tell it to wipe

the value).



Pete



> -----Original Message-----

> From: Patrick Sullivan [mailto:pat@s...]

> Sent: Tuesday, March 12, 2002 3:52 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> 

> You could take the session variable to do this or even a 

> simple cookie,

> however, the user will need to have cookies enabled, best is 

> to use the

> querystring though. Cookies and sessions can get hard to track so I

> would say not to use them to store the invnum on your redirect, you

> never know what could happen, what if its like the 3rd on they are on?

> I've done something similar to this and I really was just 

> wasting time,

> It turned out to be more problematic than I thought. I eventually

> changed it to a querystring variable and all my problems disappeared.

> 

> -----Original Message-----

> From: Kat [mailto:klbond@n...] 

> Sent: Tuesday, March 12, 2002 2:32 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> Mark and Pete,

> 

> Thanks to both of you for your good suggestions.  I used the 

> code Mark 

> suggested to pass a variable back to the form for invnum and now the 

> problem is solved.  I'll try the urlencode too so I can 

> understand both 

> ways.

> 

> Another quick question - is there a way to keep the string 

> from showing

> in 

> the http: address in the browser?

> 

> 

> I'm new at this (I've programmed mainframe systems for years).  I'm 

> reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

> Programmers reference.

> 

> I have several different database queries to develop so I'm 

> sure I'll be

> 

> back here later with more questions.

> 

> Again, thanks Mark and Pete,

>     

>    Kat

> 

> 




> $subst('Email.Unsub').

> 

> 

> 




> $subst('Email.Unsub').

> 






$subst('Email.Unsub').





Message #6 by "Patrick Sullivan" <pat@s...> on Tue, 12 Mar 2002 14:52:15 -0600
You could take the session variable to do this or even a simple cookie,

however, the user will need to have cookies enabled, best is to use the

querystring though. Cookies and sessions can get hard to track so I

would say not to use them to store the invnum on your redirect, you

never know what could happen, what if its like the 3rd on they are on?

I've done something similar to this and I really was just wasting time,

It turned out to be more problematic than I thought. I eventually

changed it to a querystring variable and all my problems disappeared.



-----Original Message-----

From: Kat [mailto:klbond@n...] 

Sent: Tuesday, March 12, 2002 2:32 PM

To: ASP Databases

Subject: [asp_databases] Re: Form Validation with redirect - Lost field

value - Please Help



Mark and Pete,



Thanks to both of you for your good suggestions.  I used the code Mark 

suggested to pass a variable back to the form for invnum and now the 

problem is solved.  I'll try the urlencode too so I can understand both 

ways.



Another quick question - is there a way to keep the string from showing

in 

the http: address in the browser?





I'm new at this (I've programmed mainframe systems for years).  I'm 

reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

Programmers reference.



I have several different database queries to develop so I'm sure I'll be



back here later with more questions.



Again, thanks Mark and Pete,

    

   Kat








$subst('Email.Unsub').





Message #7 by "Kat" <klbond@n...> on Tue, 12 Mar 2002 19:04:59
Pete,



I'll try the code you're suggesting but the problem is my form doesn't 

redirect to one page (inv001r.asp).



Notice the code in my form at the bottom of my original message in this 

thread, I check the radio buttons to determine which form to redirect to.  

This is because inv001r selects different fields and uses different tables 

in the database than inv001r2 does.



So I can't make form1's form action be to inv001r always.



Thanks,  Kat







> Hi Kat,

> 

> If it were me, I would redirect the user back to the first page, pass in

> the form value through the query string, and give an error on that page.

> I would not put the error on your processing page (inv001r.asp).  And

> Mark's solution has one big caveat.  If the user has Javascript

> disabled, they will never be redirected back.  You are mixing server

> side processing with client side, and it's not a reliable approach.

> 

> Here's how I would do it:

> 

> 

> form1.asp

> 

> <form action="inv001r.asp" method="post">

> <%

>    ' Check for error message

>    If Len(Session("ERROR_STR")) > 0 Then

>       Response.Write("<div class=""ErrMessage"">")

>       Response.Write(Server.HTMLEncode(Session("ERROR_STR")))

>       Response.Write("</div>")

> 

>       ' Clear the ERROR_STR

>       Session("ERROR_STR") = ""

>    End If

> 

>    Response.Write("<input type=""text"" name=""invnum"" value=""" &

> Server.HTMLEncode(Request("invnum")) & """>")

>    

> %>

> </form>

> 

> 

> 

> inv001r.asp

> ' Do your check for EOF

> ' If not found, set ERROR_STR session variable

> ' and redirect user back to form

> 

> Session("ERROR_STR") = "INVNUM was not found."

> Response.Redirect("form1.asp?invnum=" &

> Server.URLEncode(Request.Form("invnum")) )

> 

> 

> Something like this should solve your problem (I think) and doesn't add

> the dependency that the client has Javascript enabled.

> Regards,

> Pete

> 

> 

> 

> > -----Original Message-----

> > From: Kat [mailto:klbond@n...]

> > Sent: Tuesday, March 12, 2002 2:32 PM

> > To: ASP Databases

> > Subject: [asp_databases] Re: Form Validation with redirect - 

> > Lost field

> > value - Please Help

> > 

> > 

> > Mark and Pete,

> > 

> > Thanks to both of you for your good suggestions.  I used the 

> > code Mark 

> > suggested to pass a variable back to the form for invnum and now the 

> > problem is solved.  I'll try the urlencode too so I can 

> > understand both 

> > ways.

> > 

> > Another quick question - is there a way to keep the string 

> > from showing in 

> > the http: address in the browser?

> > 

> > 

> > I'm new at this (I've programmed mainframe systems for years).  I'm 

> > reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

> > Programmers reference.

> > 

> > I have several different database queries to develop so I'm 

> > sure I'll be 

> > back here later with more questions.

> > 

> > Again, thanks Mark and Pete,

> >     

> >    Kat

> > 

> > 




> > $subst('Email.Unsub').

> > 

Message #8 by "Peter Foti (PeterF)" <PeterF@S...> on Tue, 12 Mar 2002 10:45:41 -0500
Hi Kat,



If it were me, I would redirect the user back to the first page, pass in

the form value through the query string, and give an error on that page.

I would not put the error on your processing page (inv001r.asp).  And

Mark's solution has one big caveat.  If the user has Javascript

disabled, they will never be redirected back.  You are mixing server

side processing with client side, and it's not a reliable approach.



Here's how I would do it:





form1.asp



<form action="inv001r.asp" method="post">

<%

   ' Check for error message

   If Len(Session("ERROR_STR")) > 0 Then

      Response.Write("<div class=""ErrMessage"">")

      Response.Write(Server.HTMLEncode(Session("ERROR_STR")))

      Response.Write("</div>")



      ' Clear the ERROR_STR

      Session("ERROR_STR") = ""

   End If



   Response.Write("<input type=""text"" name=""invnum"" value=""" &

Server.HTMLEncode(Request("invnum")) & """>")

   

%>

</form>







inv001r.asp

' Do your check for EOF

' If not found, set ERROR_STR session variable

' and redirect user back to form



Session("ERROR_STR") = "INVNUM was not found."

Response.Redirect("form1.asp?invnum=" &

Server.URLEncode(Request.Form("invnum")) )





Something like this should solve your problem (I think) and doesn't add

the dependency that the client has Javascript enabled.

Regards,

Pete







> -----Original Message-----

> From: Kat [mailto:klbond@n...]

> Sent: Tuesday, March 12, 2002 2:32 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> 

> Mark and Pete,

> 

> Thanks to both of you for your good suggestions.  I used the 

> code Mark 

> suggested to pass a variable back to the form for invnum and now the 

> problem is solved.  I'll try the urlencode too so I can 

> understand both 

> ways.

> 

> Another quick question - is there a way to keep the string 

> from showing in 

> the http: address in the browser?

> 

> 

> I'm new at this (I've programmed mainframe systems for years).  I'm 

> reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

> Programmers reference.

> 

> I have several different database queries to develop so I'm 

> sure I'll be 

> back here later with more questions.

> 

> Again, thanks Mark and Pete,

>     

>    Kat

> 

> 




> $subst('Email.Unsub').

> 

Message #9 by Mark Eckeard <meckeard2000@y...> on Tue, 12 Mar 2002 07:16:41 -0800 (PST)
Kat,



I don't think you can hide it.



If that concerns you, can could use cookies or session

variables to store the invnum.  This way the invnum

will never be present in the querystring.



Mark

--- Kat <klbond@n...> wrote:

> Mark and Pete,

> 

> Thanks to both of you for your good suggestions.  I

> used the code Mark 

> suggested to pass a variable back to the form for

> invnum and now the 

> problem is solved.  I'll try the urlencode too so I

> can understand both 

> ways.

> 

> Another quick question - is there a way to keep the

> string from showing in 

> the http: address in the browser?

> 

> 

> I'm new at this (I've programmed mainframe systems

> for years).  I'm 

> reading Wrox Beginning ASP Databases and just

> ordered Wrox ASP 3.0 

> Programmers reference.

> 

> I have several different database queries to develop

> so I'm sure I'll be 

> back here later with more questions.

> 

> Again, thanks Mark and Pete,

>     

>    Kat

> 

> 





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/

Message #10 by "Kat" <klbond@n...> on Tue, 12 Mar 2002 14:32:16
Mark and Pete,



Thanks to both of you for your good suggestions.  I used the code Mark 

suggested to pass a variable back to the form for invnum and now the 

problem is solved.  I'll try the urlencode too so I can understand both 

ways.



Another quick question - is there a way to keep the string from showing in 

the http: address in the browser?





I'm new at this (I've programmed mainframe systems for years).  I'm 

reading Wrox Beginning ASP Databases and just ordered Wrox ASP 3.0 

Programmers reference.



I have several different database queries to develop so I'm sure I'll be 

back here later with more questions.



Again, thanks Mark and Pete,

    

   Kat



Message #11 by Mark Eckeard <meckeard2000@y...> on Mon, 11 Mar 2002 16:29:01 -0800 (PST)
Kat,



Are you sure the invnum is not in the database?



If so, do as I stated before.  Just store the invnum

in a local variable.  And if the recordset comes back

empty, grab that variable instead of trying thru

request.form.



Also, you can do this:



<%

if RS.BOF and RS.EOF then

%>

<script language="javascript">

    window.history.back(-1)

</script>

<%

end if

%>



This switched over to javascript, goes back one

page in the browsers history (form1.asp), and this

will retain all the values from the form.



HTH,

Mark



--- Kat <klbond@n...> wrote:

> Mark,

> 

> This is the first query I've tried to create and I'm

> second guessing 

> myself on whether it should be done this way. 

> Anyway, when inv001r 

> redirects back to form1.asp because invnum doesn't

> exist in the database, 

> the form1.asp form field box which contains

> =Request("invnum") is blank.

> 

> Instead of trying to reshow the original form1 page

> with the error 

> message there, maybe I should show the error message

> in the inv001r.asp 

> which queries the database along with a form field

> to enter another 

> invnum, which could be used to reissue the inv001r

> again.  Would this 

> make sense?

> 

> Thanks, Kat

> 

> 

> 

> > Is the value of invnum blank in the querystring or

> the

> > form?

> > 

> > Mark.

> > --- Kat <klbond@n...> wrote:

> > > Mark,

> > > 

> > > My redirect to inv001R.asp is receiving the

> invnum

> > > value like it should 

> > > (in the Case logic at the bottom of form1.asp).

> > > 

> > > In inv001R, if the invnum wasn't found in the

> > > database, I redirect back to 

> > > form1.asp but my invnum field in the form1 is

> now

> > > blank.  I used 

> > > =Request.Form("invnum") as the form field data. 

> > > Isn't this supposed to 

> > > retain it's value?.  I also tried

> > > =Request("invnum").

> > > 

> > > Here's the code in inv001R.asp redirecting back

> to

> > > form1.  I didn't think 

> > > I had to pass invnum back to form1 since I used

> > > =Request in the field.

> > > 

> > > 

> > > Set oRSp = objConn.Execute (sSQL)

> > > If oRSp.EOF then

> > >    sMSG = "INV Number Does Not Exist"

> > >    Response.Redirect("form1.asp?sMSG=" & sMSG)

> > > else

> > >    sMSG = ""

> > > end if

> > > 

> > > Thanks,  Kat 

> > > 

> > > > Kat,

> > > > 

> > > > When you first grab the invnum, store it in a

> > > > variable:

> > > > 

> > > > strInvNum = request("invnum")

> > > > 

> > > > Then, when you redirect, do this:

> > > > 

> > > > Response.Redirect("inv001R.asp?invnum=" &

> > > strInvNum)

> > > > 

> > > > Mark.

> > > > 

> > > > 

> > > > --- Kat <klbond@n...> wrote:

> > > > > I have a simple asp query form named

> form1.asp

> > > where

> > > > > the user keys the 

> > > > > invnum.  A redirect to inv001r.asp or

> > > inv001r2.asp

> > > > > is based on the radio 

> > > > > button selected.  Then inv001r (or r2)

> selects

> > > > > fields from a database 

> > > > > based on invnum and displays them in table

> > > format.

> > > > > 

> > > > > If the invnum isn't found in the database (I

> > > check

> > > > > for If rs.eof) I 

> > > > > response.redirect back to the form1.asp.

> > > > > 

> > > > > The problem is the invnum value in the form

> > > field is

> > > > > wiped out (blank) on 

> > > > > the return to form1.

> > > > > 

> > > > > I thought =Request.Form("invnum") should

> retain

> > > the

> > > > > value.  Does anyone 

> > > > > see what went wrong?

> > > > > 

> > > > > Thanks,  Kat 

> > > > >   

> > > > > 

> > > > > <%@ Language=VBScript %>

> > > > > <% Response.Buffer = True %>

> > > > > <% sMSG = trim(request.querystring("sMSG"))

> %>

> > > > > 

> > > > > <html>

> > > > > <head>

> > > > > <title>New Page 1</title>

> > > > > </head>

> > > > > <body>

> > > > > <h1>My Form Example</h1>

> > > > > <p></p>

> > > > > <% Response.Write "<p></p><table><tr><td>" &

> > > sMSG &

> > > > > "</td></tr></table>" %>

> > > > > 

> > > > > <form action 

> > > > >

> "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> > > > > method="post">

> > > > > <table border="0" cellspacing="0"

> > > > > width="100%"><tr><td 

> > > > > width="100%"><hr></td></tr></table>

> > > > > <br>

> > > > > <table border="0" cellspacing="0"

> width="100%"

> > > > > cellpadding="0"><tr><td 

> > > > > width="100%" valign="bottom">

> > > > > <h3>Inquiry by Inv</h3></td></tr></table>

> > > > > 

> > > > > <table>

> > > > > <tr><td>Inv Number &nbsp;</td><td><input

> > > type=text

> > > > > name=invnum value="<%

> > > > > =Request.Form("invnum")%>"><input

> type=submit

> > > > > name=btnSubmit 

> > > > > value=search></td</tr>

> > > > > <tr><td>&nbsp; </td></tr>

> > > > > <tr><td>&nbsp; </td><td><input type="radio"

> > > > > name="page" value 

> > > > > = "invstruct" checked>&nbsp; View the

> Structure

> > > for

> > > > > INV</td></tr>

> > > > > <tr><td>&nbsp; </td><td><input type="radio"

> > > > > name="page" value 

> > > > > = "budact">&nbsp; Departments Showing Budget

> and

> > > > > Actual Dollars</td></tr>

> > > > > </table>

> > > > > 

> > > > > <table border="0" cellspacing="0"

> width="100%"

> > > > > cellpadding="0"><tr><td 

> > > > > width="100%"><hr></td></tr></table>

> > > > > <p></p>

> > > > > </form>

> > > > > 

> > > > > <p></p>

> > > > > </body>

> > > > > </html>

> > > > > 

> > > > > <%

> > > > > strURL = Request.Form("page")

> > > > > Select Case lcase(strURL)

> > > > > Case "invstruct"

> > > > > Response.Redirect("inv001R.asp?invnum=" &

> > > > > Request("invnum"))

> > > > > Case "budact"

> > > > > Response.Redirect("inv001R2.asp?invnum=" &

> > > > > Request("invnum"))

> > > > > End Select

> > > > > %>

> > > > >  





> > > > $subst('Email.Unsub').

> > > > 

> > > > 

> > > >

> __________________________________________________

> > > > Do You Yahoo!?

> > > > Try FREE Yahoo! Mail - the world's greatest

> free

> > > email!

> 

=== message truncated ===





__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/

Message #12 by "Peter Foti (PeterF)" <PeterF@S...> on Mon, 11 Mar 2002 15:59:24 -0500
When you do this:



Response.Redirect("form1.asp?sMSG=" & sMSG)



You are redirecting back without any of the form data that was posted.

If you wish to pass this information back, you'll have to add it to your

query string, and then parse the query string on the page form1.asp.

For example:



Response.Redirect("form1.asp?invnum=" &

Server.URLEncode(Request.Form("invnum")) & "&sMSG=" & sMSG)



Then on form1.asp



Response.Write("<input type=""text"" value=""" &

Server.HTMLEncode(Request("invnum")) & """>")



Hope this helps.

Pete





> -----Original Message-----

> From: Kat [mailto:klbond@n...]

> Sent: Monday, March 11, 2002 8:34 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Form Validation with redirect - 

> Lost field

> value - Please Help

> 

> 

> Mark,

> 

> My redirect to inv001R.asp is receiving the invnum value like 

> it should 

> (in the Case logic at the bottom of form1.asp).

> 

> In inv001R, if the invnum wasn't found in the database, I 

> redirect back to 

> form1.asp but my invnum field in the form1 is now blank.  I used 

> =Request.Form("invnum") as the form field data.  Isn't this 

> supposed to 

> retain it's value?.  I also tried =Request("invnum").

> 

> Here's the code in inv001R.asp redirecting back to form1.  I 

> didn't think 

> I had to pass invnum back to form1 since I used =Request in the field.

> 

> 

> Set oRSp = objConn.Execute (sSQL)

> If oRSp.EOF then

>    sMSG = "INV Number Does Not Exist"

>    Response.Redirect("form1.asp?sMSG=" & sMSG)

> else

>    sMSG = ""

> end if

> 

> Thanks,  Kat 

> 

> > Kat,

> > 

> > When you first grab the invnum, store it in a

> > variable:

> > 

> > strInvNum = request("invnum")

> > 

> > Then, when you redirect, do this:

> > 

> > Response.Redirect("inv001R.asp?invnum=" & strInvNum)

> > 

> > Mark.

> > 

> > 

> > --- Kat <klbond@n...> wrote:

> > > I have a simple asp query form named form1.asp where

> > > the user keys the 

> > > invnum.  A redirect to inv001r.asp or inv001r2.asp

> > > is based on the radio 

> > > button selected.  Then inv001r (or r2) selects

> > > fields from a database 

> > > based on invnum and displays them in table format.

> > > 

> > > If the invnum isn't found in the database (I check

> > > for If rs.eof) I 

> > > response.redirect back to the form1.asp.

> > > 

> > > The problem is the invnum value in the form field is

> > > wiped out (blank) on 

> > > the return to form1.

> > > 

> > > I thought =Request.Form("invnum") should retain the

> > > value.  Does anyone 

> > > see what went wrong?

> > > 

> > > Thanks,  Kat 

> > >   

> > > 

> > > <%@ Language=VBScript %>

> > > <% Response.Buffer = True %>

> > > <% sMSG = trim(request.querystring("sMSG")) %>

> > > 

> > > <html>

> > > <head>

> > > <title>New Page 1</title>

> > > </head>

> > > <body>

> > > <h1>My Form Example</h1>

> > > <p></p>

> > > <% Response.Write "<p></p><table><tr><td>" & sMSG &

> > > "</td></tr></table>" %>

> > > 

> > > <form action 

> > > "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> > > method="post">

> > > <table border="0" cellspacing="0"

> > > width="100%"><tr><td 

> > > width="100%"><hr></td></tr></table>

> > > <br>

> > > <table border="0" cellspacing="0" width="100%"

> > > cellpadding="0"><tr><td 

> > > width="100%" valign="bottom">

> > > <h3>Inquiry by Inv</h3></td></tr></table>

> > > 

> > > <table>

> > > <tr><td>Inv Number &nbsp;</td><td><input type=text

> > > name=invnum value="<%

> > > =Request.Form("invnum")%>"><input type=submit

> > > name=btnSubmit 

> > > value=search></td</tr>

> > > <tr><td>&nbsp; </td></tr>

> > > <tr><td>&nbsp; </td><td><input type="radio"

> > > name="page" value 

> > > = "invstruct" checked>&nbsp; View the Structure for

> > > INV</td></tr>

> > > <tr><td>&nbsp; </td><td><input type="radio"

> > > name="page" value 

> > > = "budact">&nbsp; Departments Showing Budget and

> > > Actual Dollars</td></tr>

> > > </table>

> > > 

> > > <table border="0" cellspacing="0" width="100%"

> > > cellpadding="0"><tr><td 

> > > width="100%"><hr></td></tr></table>

> > > <p></p>

> > > </form>

> > > 

> > > <p></p>

> > > </body>

> > > </html>

> > > 

> > > <%

> > > strURL = Request.Form("page")

> > > Select Case lcase(strURL)

> > > Case "invstruct"

> > > Response.Redirect("inv001R.asp?invnum=" &

> > > Request("invnum"))

> > > Case "budact"

> > > Response.Redirect("inv001R2.asp?invnum=" &

> > > Request("invnum"))

> > > End Select

> > > %>

> > >  





> > $subst('Email.Unsub').

> > 

> > 

> > __________________________________________________

> > Do You Yahoo!?

> > Try FREE Yahoo! Mail - the world's greatest free email!

> > http://mail.yahoo.com/

> 




> $subst('Email.Unsub').

> 

Message #13 by Mark Eckeard <meckeard2000@y...> on Mon, 11 Mar 2002 12:49:26 -0800 (PST)
Is the value of invnum blank in the querystring or the

form?



Mark.

--- Kat <klbond@n...> wrote:

> Mark,

> 

> My redirect to inv001R.asp is receiving the invnum

> value like it should 

> (in the Case logic at the bottom of form1.asp).

> 

> In inv001R, if the invnum wasn't found in the

> database, I redirect back to 

> form1.asp but my invnum field in the form1 is now

> blank.  I used 

> =Request.Form("invnum") as the form field data. 

> Isn't this supposed to 

> retain it's value?.  I also tried

> =Request("invnum").

> 

> Here's the code in inv001R.asp redirecting back to

> form1.  I didn't think 

> I had to pass invnum back to form1 since I used

> =Request in the field.

> 

> 

> Set oRSp = objConn.Execute (sSQL)

> If oRSp.EOF then

>    sMSG = "INV Number Does Not Exist"

>    Response.Redirect("form1.asp?sMSG=" & sMSG)

> else

>    sMSG = ""

> end if

> 

> Thanks,  Kat 

> 

> > Kat,

> > 

> > When you first grab the invnum, store it in a

> > variable:

> > 

> > strInvNum = request("invnum")

> > 

> > Then, when you redirect, do this:

> > 

> > Response.Redirect("inv001R.asp?invnum=" &

> strInvNum)

> > 

> > Mark.

> > 

> > 

> > --- Kat <klbond@n...> wrote:

> > > I have a simple asp query form named form1.asp

> where

> > > the user keys the 

> > > invnum.  A redirect to inv001r.asp or

> inv001r2.asp

> > > is based on the radio 

> > > button selected.  Then inv001r (or r2) selects

> > > fields from a database 

> > > based on invnum and displays them in table

> format.

> > > 

> > > If the invnum isn't found in the database (I

> check

> > > for If rs.eof) I 

> > > response.redirect back to the form1.asp.

> > > 

> > > The problem is the invnum value in the form

> field is

> > > wiped out (blank) on 

> > > the return to form1.

> > > 

> > > I thought =Request.Form("invnum") should retain

> the

> > > value.  Does anyone 

> > > see what went wrong?

> > > 

> > > Thanks,  Kat 

> > >   

> > > 

> > > <%@ Language=VBScript %>

> > > <% Response.Buffer = True %>

> > > <% sMSG = trim(request.querystring("sMSG")) %>

> > > 

> > > <html>

> > > <head>

> > > <title>New Page 1</title>

> > > </head>

> > > <body>

> > > <h1>My Form Example</h1>

> > > <p></p>

> > > <% Response.Write "<p></p><table><tr><td>" &

> sMSG &

> > > "</td></tr></table>" %>

> > > 

> > > <form action 

> > > "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> > > method="post">

> > > <table border="0" cellspacing="0"

> > > width="100%"><tr><td 

> > > width="100%"><hr></td></tr></table>

> > > <br>

> > > <table border="0" cellspacing="0" width="100%"

> > > cellpadding="0"><tr><td 

> > > width="100%" valign="bottom">

> > > <h3>Inquiry by Inv</h3></td></tr></table>

> > > 

> > > <table>

> > > <tr><td>Inv Number &nbsp;</td><td><input

> type=text

> > > name=invnum value="<%

> > > =Request.Form("invnum")%>"><input type=submit

> > > name=btnSubmit 

> > > value=search></td</tr>

> > > <tr><td>&nbsp; </td></tr>

> > > <tr><td>&nbsp; </td><td><input type="radio"

> > > name="page" value 

> > > = "invstruct" checked>&nbsp; View the Structure

> for

> > > INV</td></tr>

> > > <tr><td>&nbsp; </td><td><input type="radio"

> > > name="page" value 

> > > = "budact">&nbsp; Departments Showing Budget and

> > > Actual Dollars</td></tr>

> > > </table>

> > > 

> > > <table border="0" cellspacing="0" width="100%"

> > > cellpadding="0"><tr><td 

> > > width="100%"><hr></td></tr></table>

> > > <p></p>

> > > </form>

> > > 

> > > <p></p>

> > > </body>

> > > </html>

> > > 

> > > <%

> > > strURL = Request.Form("page")

> > > Select Case lcase(strURL)

> > > Case "invstruct"

> > > Response.Redirect("inv001R.asp?invnum=" &

> > > Request("invnum"))

> > > Case "budact"

> > > Response.Redirect("inv001R2.asp?invnum=" &

> > > Request("invnum"))

> > > End Select

> > > %>

> > >  





> > $subst('Email.Unsub').

> > 

> > 

> > __________________________________________________

> > Do You Yahoo!?

> > Try FREE Yahoo! Mail - the world's greatest free

> email!

> > http://mail.yahoo.com/

> 





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/

Message #14 by "Kat" <klbond@n...> on Mon, 11 Mar 2002 20:34:09
Mark,



My redirect to inv001R.asp is receiving the invnum value like it should 

(in the Case logic at the bottom of form1.asp).



In inv001R, if the invnum wasn't found in the database, I redirect back to 

form1.asp but my invnum field in the form1 is now blank.  I used 

=Request.Form("invnum") as the form field data.  Isn't this supposed to 

retain it's value?.  I also tried =Request("invnum").



Here's the code in inv001R.asp redirecting back to form1.  I didn't think 

I had to pass invnum back to form1 since I used =Request in the field.





Set oRSp = objConn.Execute (sSQL)

If oRSp.EOF then

   sMSG = "INV Number Does Not Exist"

   Response.Redirect("form1.asp?sMSG=" & sMSG)

else

   sMSG = ""

end if



Thanks,  Kat 



> Kat,

> 

> When you first grab the invnum, store it in a

> variable:

> 

> strInvNum = request("invnum")

> 

> Then, when you redirect, do this:

> 

> Response.Redirect("inv001R.asp?invnum=" & strInvNum)

> 

> Mark.

> 

> 

> --- Kat <klbond@n...> wrote:

> > I have a simple asp query form named form1.asp where

> > the user keys the 

> > invnum.  A redirect to inv001r.asp or inv001r2.asp

> > is based on the radio 

> > button selected.  Then inv001r (or r2) selects

> > fields from a database 

> > based on invnum and displays them in table format.

> > 

> > If the invnum isn't found in the database (I check

> > for If rs.eof) I 

> > response.redirect back to the form1.asp.

> > 

> > The problem is the invnum value in the form field is

> > wiped out (blank) on 

> > the return to form1.

> > 

> > I thought =Request.Form("invnum") should retain the

> > value.  Does anyone 

> > see what went wrong?

> > 

> > Thanks,  Kat 

> >   

> > 

> > <%@ Language=VBScript %>

> > <% Response.Buffer = True %>

> > <% sMSG = trim(request.querystring("sMSG")) %>

> > 

> > <html>

> > <head>

> > <title>New Page 1</title>

> > </head>

> > <body>

> > <h1>My Form Example</h1>

> > <p></p>

> > <% Response.Write "<p></p><table><tr><td>" & sMSG &

> > "</td></tr></table>" %>

> > 

> > <form action 

> > "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> > method="post">

> > <table border="0" cellspacing="0"

> > width="100%"><tr><td 

> > width="100%"><hr></td></tr></table>

> > <br>

> > <table border="0" cellspacing="0" width="100%"

> > cellpadding="0"><tr><td 

> > width="100%" valign="bottom">

> > <h3>Inquiry by Inv</h3></td></tr></table>

> > 

> > <table>

> > <tr><td>Inv Number &nbsp;</td><td><input type=text

> > name=invnum value="<%

> > =Request.Form("invnum")%>"><input type=submit

> > name=btnSubmit 

> > value=search></td</tr>

> > <tr><td>&nbsp; </td></tr>

> > <tr><td>&nbsp; </td><td><input type="radio"

> > name="page" value 

> > = "invstruct" checked>&nbsp; View the Structure for

> > INV</td></tr>

> > <tr><td>&nbsp; </td><td><input type="radio"

> > name="page" value 

> > = "budact">&nbsp; Departments Showing Budget and

> > Actual Dollars</td></tr>

> > </table>

> > 

> > <table border="0" cellspacing="0" width="100%"

> > cellpadding="0"><tr><td 

> > width="100%"><hr></td></tr></table>

> > <p></p>

> > </form>

> > 

> > <p></p>

> > </body>

> > </html>

> > 

> > <%

> > strURL = Request.Form("page")

> > Select Case lcase(strURL)

> > Case "invstruct"

> > Response.Redirect("inv001R.asp?invnum=" &

> > Request("invnum"))

> > Case "budact"

> > Response.Redirect("inv001R2.asp?invnum=" &

> > Request("invnum"))

> > End Select

> > %>

> >  





> $subst('Email.Unsub').

> 

> 

> __________________________________________________

> Do You Yahoo!?

> Try FREE Yahoo! Mail - the world's greatest free email!

> http://mail.yahoo.com/

Message #15 by Mark Eckeard <meckeard2000@y...> on Mon, 11 Mar 2002 11:29:58 -0800 (PST)
Kat,



When you first grab the invnum, store it in a

variable:



strInvNum = request("invnum")



Then, when you redirect, do this:



Response.Redirect("inv001R.asp?invnum=" & strInvNum)



Mark.





--- Kat <klbond@n...> wrote:

> I have a simple asp query form named form1.asp where

> the user keys the 

> invnum.  A redirect to inv001r.asp or inv001r2.asp

> is based on the radio 

> button selected.  Then inv001r (or r2) selects

> fields from a database 

> based on invnum and displays them in table format.

> 

> If the invnum isn't found in the database (I check

> for If rs.eof) I 

> response.redirect back to the form1.asp.

> 

> The problem is the invnum value in the form field is

> wiped out (blank) on 

> the return to form1.

> 

> I thought =Request.Form("invnum") should retain the

> value.  Does anyone 

> see what went wrong?

> 

> Thanks,  Kat 

>   

> 

> <%@ Language=VBScript %>

> <% Response.Buffer = True %>

> <% sMSG = trim(request.querystring("sMSG")) %>

> 

> <html>

> <head>

> <title>New Page 1</title>

> </head>

> <body>

> <h1>My Form Example</h1>

> <p></p>

> <% Response.Write "<p></p><table><tr><td>" & sMSG &

> "</td></tr></table>" %>

> 

> <form action 

> "<%=Request.ServerVariables("SCRIPT_NAME")%>"

> method="post">

> <table border="0" cellspacing="0"

> width="100%"><tr><td 

> width="100%"><hr></td></tr></table>

> <br>

> <table border="0" cellspacing="0" width="100%"

> cellpadding="0"><tr><td 

> width="100%" valign="bottom">

> <h3>Inquiry by Inv</h3></td></tr></table>

> 

> <table>

> <tr><td>Inv Number &nbsp;</td><td><input type=text

> name=invnum value="<%

> =Request.Form("invnum")%>"><input type=submit

> name=btnSubmit 

> value=search></td</tr>

> <tr><td>&nbsp; </td></tr>

> <tr><td>&nbsp; </td><td><input type="radio"

> name="page" value 

> = "invstruct" checked>&nbsp; View the Structure for

> INV</td></tr>

> <tr><td>&nbsp; </td><td><input type="radio"

> name="page" value 

> = "budact">&nbsp; Departments Showing Budget and

> Actual Dollars</td></tr>

> </table>

> 

> <table border="0" cellspacing="0" width="100%"

> cellpadding="0"><tr><td 

> width="100%"><hr></td></tr></table>

> <p></p>

> </form>

> 

> <p></p>

> </body>

> </html>

> 

> <%

> strURL = Request.Form("page")

> Select Case lcase(strURL)

> Case "invstruct"

> Response.Redirect("inv001R.asp?invnum=" &

> Request("invnum"))

> Case "budact"

> Response.Redirect("inv001R2.asp?invnum=" &

> Request("invnum"))

> End Select

> %>

>  





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Try FREE Yahoo! Mail - the world's greatest free email!

http://mail.yahoo.com/

Message #16 by "Kat" <klbond@n...> on Mon, 11 Mar 2002 19:32:03
I have a simple asp query form named form1.asp where the user keys the 

invnum.  A redirect to inv001r.asp or inv001r2.asp is based on the radio 

button selected.  Then inv001r (or r2) selects fields from a database 

based on invnum and displays them in table format.



If the invnum isn't found in the database (I check for If rs.eof) I 

response.redirect back to the form1.asp.



The problem is the invnum value in the form field is wiped out (blank) on 

the return to form1.



I thought =Request.Form("invnum") should retain the value.  Does anyone 

see what went wrong?



Thanks,  Kat 

  



<%@ Language=VBScript %>

<% Response.Buffer = True %>

<% sMSG = trim(request.querystring("sMSG")) %>



<html>

<head>

<title>New Page 1</title>

</head>

<body>

<h1>My Form Example</h1>

<p></p>

<% Response.Write "<p></p><table><tr><td>" & sMSG & "</td></tr></table>"
%>



<form action = "<%=Request.ServerVariables("SCRIPT_NAME")%>" method="post">

<table border="0" cellspacing="0" width="100%"><tr><td 

width="100%"><hr></td></tr></table>

<br>

<table border="0" cellspacing="0" width="100%" cellpadding="0"><tr><td 

width="100%" valign="bottom">

<h3>Inquiry by Inv</h3></td></tr></table>



<table>

<tr><td>Inv Number &nbsp;</td><td><input type=text name=invnum value="<%

=Request.Form("invnum")%>"><input type=submit name=btnSubmit 

value=search></td</tr>

<tr><td>&nbsp; </td></tr>

<tr><td>&nbsp; </td><td><input type="radio" name="page" value 

= "invstruct" checked>&nbsp; View the Structure for INV</td></tr>

<tr><td>&nbsp; </td><td><input type="radio" name="page" value 

= "budact">&nbsp; Departments Showing Budget and Actual Dollars</td></tr>

</table>



<table border="0" cellspacing="0" width="100%" cellpadding="0"><tr><td 

width="100%"><hr></td></tr></table>

<p></p>

</form>



<p></p>

</body>

</html>



<%

strURL = Request.Form("page")

Select Case lcase(strURL)

Case "invstruct"

Response.Redirect("inv001R.asp?invnum=" & Request("invnum"))

Case "budact"

Response.Redirect("inv001R2.asp?invnum=" & Request("invnum"))

End Select

%>


  Return to Index