473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

checkboxes don't submit if empty?


A friend using my software called me and said some templates were being
reset to default when he submitted a form. I'm trying to track down the
problem. It looks like when he assigns a template to some webpages, any
page not assigned to that template is having its template reset to the
default. I'm not sure why. I've been assuming that with checkboxes
nothing gets submitted to the server if the checkbox is left unchecked.
Isn't that so?

Sample of the form below. The value equals the id of the webpage. The
template is choosen at the top of the from (that part is not included
here). An array of page ids is built up and submitted to the server, a
PHP script goes throught the array and sets all those pages whose ids
are submitted to the choosen template. None of the other pages should
be effected by this form, yes?

---------------------------------

<input type="checkbox" name="formList[]" value="408"> Assign? -
Scholarship - <a href="index.php?pageId=408">See this page?</a><br />
<hr><p>
<input type="checkbox" name="formList[]" value="439"> Assign? - Welcome
from Head of the School - <a href="index.php?pageId=439">See this
page?</a><br /> <hr><p>
<input type="checkbox" name="formList[]" value="440"> Assign? - Mission
and Philosophy - <a href="index.php?pageId=440">See this page?</a><br
/> <hr><p>
<input type="checkbox" name="formList[]" value="441"> Assign? - General
Overview /SCHOOL TOUR - <a href="index.php?pageId=441">See this
page?</a><br /> <hr><p>

<input type="checkbox" name="formList[]" value="442"> Assign? - Faculty
- <a href="index.php?pageId=442">See this page?</a><br /> <hr><p>
<input type="checkbox" name="formList[]" value="443"> Assign? -
nurturing the whole child - <a href="index.php?pageId=443">See this
page?</a><br /> <hr><p>
<input type="checkbox" name="formList[]" value="445"> Assign? -
Scholarship - <a href="index.php?pageId=445">See this page?</a><br />
<hr><p>
<input type="checkbox" name="formList[]" value="446"> Assign? - Core
Curriculum - <a href="index.php?pageId=446">See this page?</a><br />
<hr><p>
\

Jul 17 '05 #1
3 2009
I noticed that Message-ID:
<11**********************@o13g2000cwo.googlegroups .com> from
lk******@geocities.com contained the following:
A friend using my software called me and said some templates were being
reset to default when he submitted a form. I'm trying to track down the
problem. It looks like when he assigns a template to some webpages, any
page not assigned to that template is having its template reset to the
default. I'm not sure why. I've been assuming that with checkboxes
nothing gets submitted to the server if the checkbox is left unchecked.
Isn't that so?


Yes. Only checked values will appear in the array.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
lk******@geocities.com wrote:
A friend using my software called me and said some templates were
being reset to default when he submitted a form. I'm trying to track
down the problem. It looks like when he assigns a template to some
webpages, any page not assigned to that template is having its
template reset to the
default. I'm not sure why. I've been assuming that with checkboxes
nothing gets submitted to the server if the checkbox is left
unchecked. Isn't that so?


This is correct, nothing is submitted.

In the case of your form (snipped), if you had selected eg the ones with
a value of 408, 440 and 441 you would end up with an array called
formList with the values 408, 440 and 441. None of the other checkbox
values would be in this.

Is this form able to edit existing records in the database? If so, are
you doing the correct handling to remove entries that are not
submitted?

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #3
On 3 Feb 2005 16:01:26 -0800, lk******@geocities.com wrote:
I've been assuming that with checkboxes
nothing gets submitted to the server if the checkbox is left unchecked.


http://www.w3.org/TR/html4/interact/forms.html#checkbox
' Checkboxes (and radio buttons) are on/off switches that may be toggled by
the user. A switch is "on" when the control element's checked attribute is set.
When a form is submitted, only "on" checkbox controls can become successful.'

http://www.w3.org/TR/html4/interact/...html#h-17.13.2
'17.13.2 Successful controls

A successful control is "valid" for submission. Every successful control has
its control name paired with its current value as part of the submitted form
data set. A successful control must be defined within a FORM element and must
have a control name.'

So, yes, the assumption is correct according to the specs.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
4
by: Pete | last post by:
Okay, I'm still stuck with this problem. Here's a quick recap/summary :- 1. Page 1:User checks 3 out of 10 checkboxes and submits form to page 2 2. Page 2:Item count shows 3 items. User checks...
8
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here...
12
by: Keith Page | last post by:
I have a page that changes a list of checkboxes based on what city you select, however when i insert the new nodes the values are not submitted when the boxes are checked and form is sent, its like...
6
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++)...
1
by: SC G | last post by:
Hi, I use a web application that has 120 checkboxes on it for me to select from before I submit a form. I have to select boxes in groups of 40 (1-40,41-80,81-120). Each submission generates a...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
15
by: Sonnich | last post by:
Hi all! I have a file where I'd have to submit buttons, and I need to differ between those. Step #1 - open html win with default selection Step #2 - user may select some criteries for the...
4
by: Jean Ceugniet | last post by:
Hi, I just made my very first ajax form submitting. This works perfectly (myAjax01 is a variable external to this function). **************************** Code >> ****************************...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.