473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Asp forms and variables

I am passing a variable from one asp page to another say "land registry". It
puts the variable in the URL (as land%20registry) as you'd expect. I want to
add it to a hidden text box in a form so that I can then pass it back
(eliminating the need to store this original search variable in a cookie).
However even though I can response.write the variable as "land registry" on
the new page, so I know the variable is correct once its passed - it puts it
in the text box on the form as just "land" so then when it passes back from
the GET action of the form - it passes it back as only "land". If I then
write Land Registry into the form text box it works fine, but as this will be
eventually hidden and the user has already typed the search string on the
original page - this is not an option! Any ideas anyone please?

GwenP
Jul 22 '05 #1
6 1264
Only an idea

Response.Write Replace(myvar, "%20", " ")
Jul 22 '05 #2
Instead of GET (Request.QueryString("myvar")) use POST
(Request.Form("myvar"))
Jul 22 '05 #3
Make sure your input value is surrounded by quotes. Actually, make sure all
tag attributes are.

NO: <input type=text value=land registry>
YES: <input type="text" value="land registry" />

Ray at work

"GwenP" <Gw***@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
I am passing a variable from one asp page to another say "land registry". It puts the variable in the URL (as land%20registry) as you'd expect. I want to add it to a hidden text box in a form so that I can then pass it back
(eliminating the need to store this original search variable in a cookie).
However even though I can response.write the variable as "land registry" on the new page, so I know the variable is correct once its passed - it puts it in the text box on the form as just "land" so then when it passes back from the GET action of the form - it passes it back as only "land". If I then
write Land Registry into the form text box it works fine, but as this will be eventually hidden and the user has already typed the search string on the
original page - this is not an option! Any ideas anyone please?

GwenP

Jul 22 '05 #4
Sorry - neither of these suggestions worked. I have the variable - I can see
it - why can I not just populate my text box with it if it comprises more
than one word? I have tried setting white space on and off still not
working.....?

Gwen

"GwenP" wrote:
I am passing a variable from one asp page to another say "land registry". It
puts the variable in the URL (as land%20registry) as you'd expect. I want to
add it to a hidden text box in a form so that I can then pass it back
(eliminating the need to store this original search variable in a cookie).
However even though I can response.write the variable as "land registry" on
the new page, so I know the variable is correct once its passed - it puts it
in the text box on the form as just "land" so then when it passes back from
the GET action of the form - it passes it back as only "land". If I then
write Land Registry into the form text box it works fine, but as this will be
eventually hidden and the user has already typed the search string on the
original page - this is not an option! Any ideas anyone please?

GwenP

Jul 22 '05 #5
Who is this reply addressed to? You replied to your own post. Whose
suggestions? Gérard's? Ray's?

Ray at work

"GwenP" <Gw***@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
Sorry - neither of these suggestions worked. I have the variable - I can see it - why can I not just populate my text box with it if it comprises more
than one word? I have tried setting white space on and off still not
working.....?

Gwen

"GwenP" wrote:
I am passing a variable from one asp page to another say "land registry". It puts the variable in the URL (as land%20registry) as you'd expect. I want to add it to a hidden text box in a form so that I can then pass it back
(eliminating the need to store this original search variable in a cookie). However even though I can response.write the variable as "land registry" on the new page, so I know the variable is correct once its passed - it puts it in the text box on the form as just "land" so then when it passes back from the GET action of the form - it passes it back as only "land". If I then write Land Registry into the form text box it works fine, but as this will be eventually hidden and the user has already typed the search string on the original page - this is not an option! Any ideas anyone please?

GwenP

Jul 22 '05 #6
Create a small page to reproduce the problem. Only put in the minimum html
and server-side code to allow the problem to be seen and post it here. For
example, this page:

<HTML>
<BODY>

<form method="get">
<INPUT type="text" name=text1 value="
<%=server.HTMLEncode(Request.QueryString("text1")) %>">
<INPUT type="submit" value="Submit" name=submit1>
</form>

</BODY>
</HTML>

called with this url:
http://localhost/test/pass_string_wi...and%20registry

results in this output in my IE6 browser (I'm not sure you'll be able to see
the following copy-and-paste. If not, take my word that "land registry"
appears in the text box):

What does it do in your browser?

I used Server.HTMLEncode just in case the querystring contained quote
characters (or other characters that could create problems.

Bob Barrows

GwenP wrote:
Sorry - neither of these suggestions worked. I have the variable - I
can see it - why can I not just populate my text box with it if it
comprises more than one word? I have tried setting white space on
and off still not working.....?

Gwen

"GwenP" wrote:
I am passing a variable from one asp page to another say "land
registry". It puts the variable in the URL (as land%20registry) as
you'd expect. I want to add it to a hidden text box in a form so
that I can then pass it back (eliminating the need to store this
original search variable in a cookie). However even though I can
response.write the variable as "land registry" on the new page, so I
know the variable is correct once its passed - it puts it in the
text box on the form as just "land" so then when it passes back from
the GET action of the form - it passes it back as only "land". If I
then write Land Registry into the form text box it works fine, but
as this will be eventually hidden and the user has already typed the
search string on the original page - this is not an option! Any
ideas anyone please?

GwenP


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sumithradevi | last post by:
Hello Friends, I have two forms(form1 and form2) on my html page. question1 : can i access form 1 variables in form 2?. if so how? question 2: when form2 action is saveci.jsp . can i access...
13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
12
by: Casey | last post by:
Yeah, I know this question was asked by someone elselike 2 weeks ago. But I need some additional help. I have a program I'm developing, and multiple different forms will be opened. For now though,...
2
by: Wilder | last post by:
I wrote a simple funtion to automatically compute corrected azimuths in several places in a database but am having trouble implementing it. I placed the function in a module and am trying to pass...
3
by: Jessica Loriena | last post by:
I'm trying to write a simple "register form / validate and store in database / show welcome screen" application with ASP.Net. With conventional ASP, I used Session variables and it went something...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
2
by: dumbo | last post by:
Hello, who gives one more shining solution to me? My application load form "A". The form "A" by means of a push-button load form "B" that in its turn by means of a push-button load form "C". Form...
1
by: Troy Bull | last post by:
Greetings I am trying to use a singleton to hold a group of forms. I have a MDIMaster form. I have a class called Forms; Forms is a singleton. I want to do something like the following. In...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.