Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unchecked boxes - no value?

Status
Not open for further replies.

daveh

Technical User
Jun 22, 2000
57
GB
I am working on a form which has a number of different fields, from a hidden field, text box, combo box, to a collection of check boxes.

I am using the GET form method, and when the form is submitted, all the fields are sent as paramaters, but only check boxes that have been checked are appended. ie. unchecked checkboxes are disregarded when submitting queries. I don't want this! I want it to specify each box, but then say whether its checked or not. Eg. file.pl?name=Fred&Email=fred@aol.com&check1=NO, check2=YES.

Is there any way to do this? If not, is there any way to get around this?

Kind regards,
David.
 
David,

Surely by a process of elimination, you will automatically know which checkboxes haven't been checked - because they will simply be missing from the equation.

Dan
 
No. That's the way check boxes work in HTML.

I suppose somebody will come forward with some javascript that'll plug in the "missing" values - but you can't rely on such things to work in all browsers.

I don't see what your problem is really. Get your script to look for a value in check1, if it finds one the answer is "yes", otherwise it's "no". Easy.

If you have to have two values, use a pair of radio buttons, one for yes, one for no.

-- Chris Hunt
 
Daveh

We covered this a week or so ago on the Javascript forum. Here is the thread... some of the feedback offers solutions to your situation.

thread216-726366

Hope this helps,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top