Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 2nd, 2004, 04:57 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
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
  #2 (permalink)  
Old October 2nd, 2004, 05:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #3 (permalink)  
Old October 2nd, 2004, 06:08 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
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
  #4 (permalink)  
Old October 2nd, 2004, 06:11 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
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
  #5 (permalink)  
Old October 2nd, 2004, 06:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #6 (permalink)  
Old October 2nd, 2004, 10:24 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
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
  #7 (permalink)  
Old October 2nd, 2004, 10:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
  #8 (permalink)  
Old October 17th, 2004, 08:38 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
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.


  #9 (permalink)  
Old October 18th, 2004, 03:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

_________________________
- Vijay G
Strive for Perfection
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08:27 PM
Passing URL in a Querystring hugh@kmcnetwork.com Javascript How-To 3 July 8th, 2004 04:59 PM
ampersand in a querystring trangd Beginning PHP 3 October 23rd, 2003 07:54 PM



All times are GMT -4. The time now is 11:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.