| Author |
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
| |
| Gérard Leclercq 2004-12-22, 7:47 am |
| Only an idea
Response.Write Replace(myvar, "%20", " ")
| |
| Gérard Leclercq 2004-12-22, 7:47 am |
| Instead of GET (Request.QueryString("myvar")) use POST
(Request.Form("myvar"))
| |
| Ray Costanzo [MVP] 2004-12-22, 5:53 pm |
| 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" <GwenP@discussions.microsoft.com> wrote in message
news:2B1EDA48-243C-4F98-BFF9-9A48F82A43DD@microsoft.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
>
>
| |
|
| 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
>
>
| |
| Ray Costanzo [MVP] 2004-12-22, 5:54 pm |
| Who is this reply addressed to? You replied to your own post. Whose
suggestions? Gérard's? Ray's?
Ray at work
"GwenP" <GwenP@discussions.microsoft.com> wrote in message
news:94E2F396-C532-49E3-8034-3E523CF190C1@microsoft.com...
> Sorry - neither of these suggestions worked. I have the variable - I can
see[vbcol=seagreen]
> 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:
>
registry". It[vbcol=seagreen]
want to[vbcol=seagreen]
cookie).[vbcol=seagreen]
on[vbcol=seagreen]
puts it[vbcol=seagreen]
from[vbcol=seagreen]
then[vbcol=seagreen]
will be[vbcol=seagreen]
the[vbcol=seagreen]
| |
| Bob Barrows [MVP] 2004-12-22, 5:54 pm |
| 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_w...land%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:[vbcol=seagreen]
> 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:
>
--
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.
|
|
|
|