Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 4th, 2001, 04:39 AM
focus focus is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Luxembourg
Posts: 87 focus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 55 sec
Reputation Power: 9
unchecking pre-checked html checkboxes to amend a selection list

I have a script which generates a "selections" web page, where visitors click checkboxes and their selections are written to a database. They can view their selections by calling the page and current selections are shown as pre-checked by making the variable $checked = "checked", as in...

<input type="checkbox" name="C1" value="Y" $checked>

(For items not previously selected, $checked = "", so they are not pre-checked)

If visitors de-select a current selection by unchecking that checkbox, the existing "checked" value is not changed, so when checked boxes are collected by the script, all existing selections remain selected although onscreen they are de-selected.

Can anyone suggest a way around this?

Reply With Quote
  #2  
Old June 4th, 2001, 09:04 AM
mullaney mullaney is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 0 mullaney User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Do you want the changes to be applied?

Reply With Quote
  #3  
Old June 4th, 2001, 09:29 AM
focus focus is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Luxembourg
Posts: 87 focus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 55 sec
Reputation Power: 9
I want it so that a newly-checked box is accepted as a check (that bit works) and that a box which they click to uncheck it is identified as an unchecked box when the variables are passed to perl.

Is that what you were asking me for?

Reply With Quote
  #4  
Old June 5th, 2001, 11:55 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Two parts to a checkbox

Try this sample code:


<html>
<head>
<title>Test Page</title>
<script language="javascript">
function see() {
var d=document.forms[0];
alert(d.C1.checked); alert(d.C1.value);
alert(d.C2.checked); alert(d.C2.value);
alert(d.C3.checked); alert(d.C3.value);
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form method="POST">
<p><input type="checkbox" checked name="C1" value="one"></p>
<p><input type="checkbox" name="C2" value="two"></p>
<p><input type="checkbox" name="C3" value="three"></p>
<p><input type="button" name="B1" onClick="see()" value="Submit"></p>
</form>
</body>
</html>

Note: the value remains but the checked is true / false.

So what are you looking for ??
__________________
Thanks

Foot in Mouth ver 1.2.5 Onion

Reply With Quote
  #5  
Old June 5th, 2001, 01:21 PM
focus focus is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Luxembourg
Posts: 87 focus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 55 sec
Reputation Power: 9
Many thanks for your time, f-i-m, but the form was not the cause of the problem - I was looking in the wrong place.
The form was returning correct data and I was collecting that data correctly, then I was adding it to the database.

But I was not deleting the original contents of the database (his previous selections). So - of course - the old choices remained in place.

Dooohhh !
A kick in the nether regions is definitely called for.
Thanks again for your time.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > unchecking pre-checked html checkboxes to amend a selection list


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway