You are here: Re: Grabbing checkbox values « PHP Programming Language « IT news, forums, messages
Re: Grabbing checkbox values

Posted by Amer Neely on 11/13/06 16:32

Michael Fesser wrote:
> .oO(Amer Neely)
>
>> :) Sorry, I'm new with PHP so everything is literal. But as I mentioned,
>> if I check all the boxes with JS, and submit the form, it throws that
>> error. I'm going to do some reading and see what I can come up with.
>
> There's an error in your script. Try this one (tested, works here):
>
> function CheckAll(value) {
> for (i=0; i<document.forms[0].length; i++) {
> if (document.forms[0].elements[i].name == 'DeleteThis[]') {
> document.forms[0].elements[i].checked=value;
> }
> }
> }
>
> Micha

When you say it 'work's, does that mean your PHP tells you upon form
submission which boxes were checked? Mine works fine IF AND ONLY IF I
check the boxes with the mouse, even though the JS code will toggle them
on or off perfectly.

I had been playing with name of the field. First it was hard-coded to
'DeleteThis', then a suggestion was that it should be an array, so I
changed it to 'DeleteThis[]'. That didn't seem to work, so I went back
to 'DeleteThis', and changed the code to this:
if ( document.forms[0].elements[i].name =~ 'DeleteThis')
to catch everthing.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация