Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2004, 04:57 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to surbhi
Default Passing QueryString which contains ampersand sing


Hi!

I simply have to asp pages, on the first page I have a textbox. I want to pass its value to second form. But as per my requirement, user may enter ampersand sing(&) in that textbox. It works fine otherwise. Can anyone please suggest how to deal with this? its giving me trouble, i am not able to pass any value containing & sign.

Thanks
Surbhi

Surbhi
 
Old October 2nd, 2004, 05:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Surbhi,

Can you post more information on how you are posting the values, using a get/post method? What is the error if any you face? Also some code related to that would be better to see what you are missing.

_________________________
- Vijay G
Strive for Perfection
 
Old October 2nd, 2004, 06:08 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to surbhi
Default

Hi Vijay,

Thanks for you reply. I am using Post methos, the problem i am facing is - it removes rest of the value from query string.

I am submitting the form by

frmStep1.action = "cf1step.asp?action=entryvalidate";
frmStep1.target = "_self"
frmStep1.submit();

And in the next page I am trying to retrive the value in a variable -
varName = Request.QueryString("txtname")

So if I enter value in txtname - "Mr & Mrs Steve" then it just giving me Mr when i retrive the data using - varName = Request.QueryString("txtname").

So this is the problem I am facing. Hope I am making my self a bit more clear, if not please let me know.

Thanks again.
Surbhi

Surbhi
 
Old October 2nd, 2004, 06:11 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to surbhi
Default

Sorry Vijay,

In the same page in the code as below it is giving me that type of problem

If Request.QueryString("action") = "entryvalidate" then
 varName = Request.QueryString("txtname")
end if


Surbhi
 
Old October 2nd, 2004, 06:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:I am using Post method...
Quote:
quote:varName = Request.QueryString("txtname")
Your statements are contradict. If you are using POST method, then you won't be able to see any value in varName, as you are requesting from querystring.

It looks like you are using GET method.

What is the METHOD value that you mentioned in the <FORM> tag? If that is GET, I would suggest you better use POST there instead, unless there is some reason for using GET deliberately.

Note : "&" is the delimiter in a querystring that separates each variable and its value from that of the other.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 2nd, 2004, 10:24 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to surbhi
Default

Hi Vijay,

Thanks for your reply, I checked it and I am sure I am using Post. Here is the line for form

<form name="frmStep1" id="frmStep1" method="post">

Anyways i got the solution. As you said "&" is the delimiter and thats why it was giving me error.

I am not replacing the "&" with "%26" and then passing it to next form. So it is solving the problem and i am retriving the correct value in next form.

Cheers!

Surbhi
 
Old October 2nd, 2004, 10:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can you explain on how you get that on a querystring when form uses post? Or confirm if anywhere else donw the code you use Request.form("txtName") to assign the value to the same variable. Only possibility I could see for getting the value from QS is you might be coming to this page from the previous page, from where txtname would have been passed as QueryString to this page. Else I can't imagine it getting from Querystring.

Try this on top of your page.
Code:
Response.write "Req from Form : " & Request.Form("txtName") & "<BR>"
Response.write "Req from QS : " Request.Querystring("txtName") 
Response.end
and see which of them gets you the value(Form/QS).

Also I would like to know if this is one of the form fields that you are requesting. In case of using POST you should be using Request.Form("txtName") to retireve its value on submission. May be if you can post your code here, I would try and see if I am missing something.

Instead you can use Server.HTMLEncode(txtname) to resolve that.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 17th, 2004, 08:38 PM
Registered User
 
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to zakarya_hazara
Default

go to www.javascriptworld.com
you can finnd some functions that will not allow the user to type & in textbox. and if the user type & then it will show alert that & is not allowd to be typed in this textbox.


 
Old October 18th, 2004, 03:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

How about that alerting if I have javascript disabled on my browser.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing data via querystring LanceRoss Beginning VB 6 3 July 25th, 2008 12:20 PM
passing password in in querystring jaya929 ASP.NET 2.0 Professional 5 May 27th, 2008 07:47 AM
Passing a querystring value that contains '&' jfrizelle Classic ASP Databases 3 March 20th, 2006 09:27 PM
Passing URL in a Querystring [email protected] Javascript How-To 3 July 8th, 2004 04:59 PM
ampersand in a querystring trangd Beginning PHP 3 October 23rd, 2003 07:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.