Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
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 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



Report this thread to moderator Post Follow-up to this message
Old Post
GwenP
12-22-04 01:55 PM


Re: Asp forms and variables
Only an idea

Response.Write Replace(myvar, "%20", " ")



Report this thread to moderator Post Follow-up to this message
Old Post
Gérard Leclercq
12-22-04 01:55 PM


Re: Asp forms and variables
Instead of GET (Request.QueryString("myvar")) use POST
(Request.Form("myvar"))



Report this thread to moderator Post Follow-up to this message
Old Post
Gérard Leclercq
12-22-04 01:55 PM


Re: Asp forms and variables
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
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-22-04 08:56 PM


RE: Asp forms and variables
Sorry - 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
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
GwenP
12-22-04 08:56 PM


Re: Asp forms and variables
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
> 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 



Report this thread to moderator Post Follow-up to this message
Old Post
Ray Costanzo [MVP]
12-22-04 08:56 PM


Re: Asp forms and variables
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:
> 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.



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Barrows [MVP]
12-22-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:59 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.