Save text-input value checkbox, How do I go about doing this with cookies? |
![]() ![]() |
Save text-input value checkbox, How do I go about doing this with cookies? |
May 4 2008, 12:29 AM
Post
#1
|
|
|
Member ![]() ![]() Posts: 93 OS: Windows XP Pro, Windows Server 2003 |
I just started learning javascript, and I am testing things out, however if you could gimme a script straight-up I would be more than greatful! It only needs to recall / remember 1 text-input field. |
|
|
May 4 2008, 03:54 AM
Post
#2
|
|
|
Spyware Veteran Posts: 20,720 From: Netherlands OS: XP Pro & Vista Ultimate |
Hi lem.rar,
If I understand correctly you want to have a form where people can select one item and somethjing needs to be done with that. A few questions: - will al the fileds have the same name and just a different value. - should the choice be one and one only (radiobuttons would be easier in such a case) - will the resulting action be taken on the same page or does the value need to be transporte to the next? - do you already have an idea how you want it to look? (makes it easier to adapt the script to you specific wishes) |
|
|
May 4 2008, 04:11 AM
Post
#3
|
|
|
Member ![]() ![]() Posts: 93 OS: Windows XP Pro, Windows Server 2003 |
1. The value will by defined by the user, specifically "name", the only value I want to be saved.
2. A checkbox for on / off, however a radio button would be fine. 3. I'm hoping it won't touch the submission... 4. Yes, I want it to go beside the name field, right after the input text This is what I'll be applying it to: http://b64.ath.cx/maruchan/imgboard/index.htm |
|
|
May 4 2008, 05:09 AM
Post
#4
|
|
|
Spyware Veteran Posts: 20,720 From: Netherlands OS: XP Pro & Vista Ultimate |
The checkbox for the file upload?
CODE <label><input type=checkbox name=textonly value=on>No File </label> If it is checked you want to store the value in the upfile field <input type=file name=upfile size="35"> Is that correct? And what do you want to happen when it gets checked? |
|
|
May 4 2008, 05:20 AM
Post
#5
|
|
|
Member ![]() ![]() Posts: 93 OS: Windows XP Pro, Windows Server 2003 |
<input type=checkbox name=namesave value=on>
I just made this one. When it gets checked I want it to save the value that the user puts into <input type=text name=name size="28"> via a cookie, so the users don't have to type it everytime they make a post. |
|
|
May 4 2008, 07:40 AM
Post
#6
|
|
|
Spyware Veteran Posts: 20,720 From: Netherlands OS: XP Pro & Vista Ultimate |
OK . Then this should help:
http://www.quirksmode.org/js/cookies.html You can use an onClick event triggered by the checkbox to start the function createCookie and a onload event in the body to start the: function readCookie example using the functions described at quirksmode: <body onload="readCookie(name)"> <input type=checkbox name=namesave onClick="createCookie(name,value,days)"> |
|
|
May 4 2008, 08:01 AM
Post
#7
|
|
|
Member ![]() ![]() Posts: 93 OS: Windows XP Pro, Windows Server 2003 |
I can't get it to work ;_; I'm trying to get it to work via a PHP script... Here is a segment of the relevant code...
CODE $dat.=' <table cellpadding=1 cellspacing=1> <tr><td bgcolor=#eeaa88><b>Name</b></td><td><input type=text name=name size="28" value="readCookie(name)"> <input type=checkbox name=namesave onClick=createcookie("name,value,days")></td></tr> <tr><td bgcolor=#eeaa88><b>E-mail</b></td><td><input type=text name=email size="28"></td></tr> <tr><td bgcolor=#eeaa88><b>Subject</b></td><td><input type=text name=sub size="35"> <input type=submit value="Submit"></td></tr> <tr><td bgcolor=#eeaa88><b>Comment</b></td><td><textarea name=com cols="48" rows="4" wrap=soft></textarea></td></tr> '; I don't think I'm able to use the single quotation marks. I'm truly clueless now. This post has been edited by lem.rar: May 4 2008, 08:42 AM |
|
|
![]() ![]() |
Similar Topics
| Topic Title | Replies / Views | Topic Information | |||||
|---|---|---|---|---|---|---|---|
![]() |
5 / 1,007 | 11th January 2006 - 05:50 AM shawn_programing started - last by Hai Mac |
|||||
![]() |
1 / 39 | Today, 08:36 AM Clinetyme started - last by starjax |
|||||
![]() |
3 / 72 | Today, 04:18 PM tWiStEdArRow started - last by charge06 |
|||||
![]() |
0 / 8 | Today, 12:07 PM newnoi started - last by newnoi |
|||||
|
Time is now: 1st December 2008 - 11:06 PM |
| Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk. |