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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

geting fun with checkbox

Status
Not open for further replies.

flac0

Programmer
Oct 31, 2001
22
UY
Hi, everybody!
I'm with basic html problem.
I have a form with somes checkbox that could be checked or not. When the user press submit, those checkbox checked are passed with the get method to the action form (main.esp). Those checkbox unchecked aren´t recived in main.esp and I don´t know why.

For example:

<form method=&quot;get&quot; name=&quot;myform&quot; action=&quot;/main.esp&quot;>
<input type=&quot;checkbox&quot; name=&quot;ChkOne&quot; >
<input type=&quot;checkbox&quot; name=&quot;ChkTwo&quot; >
<input type=&quot;submit&quot; name=&quot;command&quot; value=&quot;Enter&quot; >
</form>

If ChkOne are checked and ChkTwo are not checked, then main.esp doesn´t recive the ChkTwo variable (WHY?!).
How could I do to recive allways all the checkbox in the form, even are not checked?!

thanks for any tip... flac0! My keyboard are on-fire baby! ;)
 
>> unchecked aren´t recived in main.esp and I don´t know
>> why.

that's the HTML standard is why. does that help?

-pete
 
ok, thanks pete! that's help, but do you know a tip to do it? a kind of trick to pass over this html standar?

Developing in asp or php, you don´t need to break this standar but in my case are a little complicated...the esp pages some time press you to do some things like that...so if you or anybody imagine a way to break up this html standar, it´ll be great!

thanks for all...flac0! My keyboard are on-fire baby! ;)
 
Well, you would have to explicitly send the values. If HTML won't explicitly send an unchecked box, then you can always disguise it by maintaining an array of values. Every radio button or checkbox uses their respective onclick event to do a quickie status check of all checkboxes and radio buttons and updates that array. Then, your onsubmit function just nabs the value of that array.

I suppose you could also explicitly pass the values in the submit button's onclick event, but I think that means you wouldn't want it to be a submit button, but just an ordinary button with a fancy-dan onclick event.

Yeesh, who let me out...?!

Good luck!
[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top