Code Comments
Programming Forum and web based access to our favorite programming groups.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 t o 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 b e 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
Post Follow-up to this messageOnly an idea Response.Write Replace(myvar, "%20", " ")
Post Follow-up to this messageInstead of GET (Request.QueryString("myvar")) use POST
(Request.Form("myvar"))
Post Follow-up to this messageMake 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 > >
Post Follow-up to this messageSorry - neither of these suggestions worked. I have the variable - I can se e 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" o n > 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 fro m > 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 > >
Post Follow-up to this messageWho 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 > 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 want to cookie). on puts it from then will be the
Post Follow-up to this messageCreate 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:
> 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.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.