Go Back   Forum Care Forums > Development Reference Area > Webmaster Topics

Reply
 
LinkBack Thread Tools Display Modes
Preserving input box text
Old
  (#1)
mike
Guest
 
Posts: n/a
Default Preserving input box text - 05-14-2007, 01:26 AM

I have a couple of similar pages on my site with a simple text box, and
if a user fills in the box and then clicks on a link to the other page,
the text box is cleared. I'd like to preserve the text in that box
even when the user switches pages. Does anyone know how to do this?

A good example is on the Google homepage. When you type something into
the box, and then click on the "Images" link, the text is preserved.
But I can't figure it out from their page source.

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: Preserving input box text
Old
  (#2)
Todd H.
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:26 AM

"mike" <EMAIL REMOVED> writes:

> I have a couple of similar pages on my site with a simple text box, and
> if a user fills in the box and then clicks on a link to the other page,
> the text box is cleared. I'd like to preserve the text in that box
> even when the user switches pages. Does anyone know how to do this?
>
> A good example is on the Google homepage. When you type something into
> the box, and then click on the "Images" link, the text is preserved.
> But I can't figure it out from their page source.


It's done server side, and not in html aqlone, and can be done in a
variety of ways. The concept is that a form field you've submitted to
a cgi program gets echo'd back in the result html source as the
default value of another form field.

What scripting language are you working with?

--
Todd H.
http://www.toddh.net/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Preserving input box text
Old
  (#3)
John Bokma
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:26 AM

"mike" <EMAIL REMOVED> wrote:

> I have a couple of similar pages on my site with a simple text box, and
> if a user fills in the box and then clicks on a link to the other page,
> the text box is cleared. I'd like to preserve the text in that box
> even when the user switches pages. Does anyone know how to do this?
>
> A good example is on the Google homepage. When you type something into
> the box, and then click on the "Images" link, the text is preserved.
> But I can't figure it out from their page source.


They encode the value you put in the box in their URL, check out the
Images link to verify this. When you click on that link, a server side
program decodes the URL, and fills in the box for you, and then returns
this result.

Depends a bit on what you want and how what solution works the best for
you.

Some time ago a provider of online email considered it a good idea to
encode the username and p***word in the URL, which was cool if the person
reading the email clicked on a link in his/her email...

--
John Need help with SEO? Get started with a SEO report of your site:

--> http://johnbokma.com/websitedesign/seo-expert-help.html
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Preserving input box text
Old
  (#4)
mike
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:27 AM

Ok, I see it now in the URL for the images link.

I suppose javascript is an easy way to implement this? I'll give it a
try and re-post if I have any problems.

Thanks!

John Bokma wrote:
> "mike" <EMAIL REMOVED> wrote:
>
> > I have a couple of similar pages on my site with a simple text box, and
> > if a user fills in the box and then clicks on a link to the other page,
> > the text box is cleared. I'd like to preserve the text in that box
> > even when the user switches pages. Does anyone know how to do this?
> >
> > A good example is on the Google homepage. When you type something into
> > the box, and then click on the "Images" link, the text is preserved.
> > But I can't figure it out from their page source.

>
> They encode the value you put in the box in their URL, check out the
> Images link to verify this. When you click on that link, a server side
> program decodes the URL, and fills in the box for you, and then returns
> this result.
>
> Depends a bit on what you want and how what solution works the best for
> you.
>
> Some time ago a provider of online email considered it a good idea to
> encode the username and p***word in the URL, which was cool if the person
> reading the email clicked on a link in his/her email...
>
> --
> John Need help with SEO? Get started with a SEO report of your site:
>
> --> http://johnbokma.com/websitedesign/seo-expert-help.html


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Preserving input box text
Old
  (#5)
Todd H.
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:27 AM

"mike" <EMAIL REMOVED> writes:

> Ok, I see it now in the URL for the images link.
>
> I suppose javascript is an easy way to implement this?


No. You need server side code, not client-side javascript.

--
Todd H.
http://www.toddh.net/
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Preserving input box text
Old
  (#6)
BBM
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:27 AM


Todd H. wrote:
> "mike" <EMAIL REMOVED> writes:
>
> > Ok, I see it now in the URL for the images link.
> >
> > I suppose javascript is an easy way to implement this?

>
> No. You need server side code, not client-side javascript.
>
> --
> Todd H.
> http://www.toddh.net/


Javascript could work if the user has it enabled. add an onclick to the
link, to grab the text in the box, and sendthe link to the appropriate
query string. And Javascript is capable of grabbing the query string,
and writing to the page. So, which it is certainly possible, I wouldn't
call it the best way to do it.

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: Preserving input box text
Old
  (#7)
mike
Guest
 
Posts: n/a
Default Re: Preserving input box text - 05-14-2007, 01:30 AM

I implemented this using javascript and it works nicely, if the user
has it enabled like you said. If you guys want to check it out visit
http://statdogg.com. You can see it when you switch between the search
types.


BBM wrote:
> Todd H. wrote:
> > "mike" <EMAIL REMOVED> writes:
> >
> > > Ok, I see it now in the URL for the images link.
> > >
> > > I suppose javascript is an easy way to implement this?

> >
> > No. You need server side code, not client-side javascript.
> >
> > --
> > Todd H.
> > http://www.toddh.net/

>
> Javascript could work if the user has it enabled. add an onclick to the
> link, to grab the text in the box, and sendthe link to the appropriate
> query string. And Javascript is capable of grabbing the query string,
> and writing to the page. So, which it is certainly possible, I wouldn't
> call it the best way to do it.


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top