From - Sat Jun 14 22:56:52 1997
Path: world1.bellatlantic.net!out2.nntp.cais.net!news2.cais.com!in1.nntp.cais.net!mr.net!news.maxwell.syr.edu!newsfeed.internetmci.com!news.wwa.com!not-for-mail
From: Wef <wef@miso.wwa.com>
Newsgroups: comp.lang.javascript
Subject: Re: [Q] - Form INPUT Values and Inserting Cookies??!!??
Date: Tue, 03 Jun 1997 22:41:14 -0500
Organization: WorldWide Access (tm) - Midwestern Internet Services http://www.wwa.com
Lines: 53
Message-ID: <3394E3DA.13B6@miso.wwa.com>
References: <339338D1.2510@miso.wwa.com> <3394332F.866B3013@ti.com>
Reply-To: wef@miso.wwa.com
NNTP-Posting-Host: pool7-056.wwa.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
CC: janeen@ti.com

Janeen Reich wrote:
> 
> Wef wrote:
> >
> > I'm trying to make a HTML doc that loads cookie stored values into
> > specific form fields...  If the docs pulls a cookie, then the cookie
> > value goes into the VALUE portion of the form INPUT tag...  It hasn't
> > worked for me yet...
> >
> > Here is what I thought would work... (Don't fret about the getCookie
> > function...)
> >
> > <CODE>
> > function show_name() {
> >         if(getCookie(cookieName) != null) {
> >         var cookieval = getCookie(cookieName);
> >         document.write("<input type=text name=\"name\" value=cookieval
> > size=30><---Your Name<br>");
> >         }
> >         else document.write("<input type=text name=\"name\"
> > size=30><---Your Name<br>");
> > }
> > </CODE>
> >
> > Using the above code, all I get in the appropriate INPUT field is :
> > "cookieval"...
> 
> I've had some luck trying this:
> 
> document.write("<input type=text name=\"name\" value=" + cookieval +
> "size=30><---Your Name<br>");

This helped very much!

But now I'm having difficulties when the cookie value has more than one
word in it...  The text input box displays only the first word in the
cookie...  

Check out the following URL's for code and an example...

http://miso.wwa.com/~wef/mk/bbs/main/set_cookie.html

http://miso.wwa.com/~wef/mk/bbs/main/poster_cookie.htm

You will have to set a cookie or two to really get the gist of the
problem...  The purpose of this all is to have cookies remember a
person's info for WWWBoard posts, and to have a form that has this info
filled out already...

----
Wef
wef@miso.wwa.com
http://miso.wwa.com/~wef/mk
