typically when I build forms like that I have a database that is giving me
all the data so I only have to update the loop once for all the checkboxes
:-)
but yes you can use the $$() Selector method to use the names - I think you
have to do it this way though
$$(input[name='kitcat[]']:checked)
// this works with names that contain spaces and arrays[]...
Validation.add('validate-one-array', 'Error message text', function(value,
element) {
var elmName = input:checkbox[name=' +element.name +'];
var bChecked = false; // not validated
$$(elmName).each(function(elm) {
if(
Prototype has a method for what you are trying called any()
http://api.prototypejs.org/language/Enumerable/prototype/any/
you create an iterator function and pass it to any
var elmName = input:checkbox[name=' +element.name +'];
var bChecked = false; // not validated
var anychecked
Ha! I knew there had to be a shorter way to do this!
Thanks!
On Mon, Apr 1, 2013 at 3:53 PM, Jason Westbrook jwestbr...@gmail.comwrote:
Prototype has a method for what you are trying called any()
http://api.prototypejs.org/language/Enumerable/prototype/any/
you create an iterator
Happy Easter!
I have an array of checkboxes on a form (about 15 of them) arranged in rows
like this:
trtdinput type='checkbox' name='kitcat[]'
.../tdtdname/tdtddescription/td/tr
What I have been trying to use is this:
$(input:checkbox[name=kitcat]:checked).each(function() {
// if one is
Try adding a separate class to all of your checkboxes that are in the group
and then do this
if( $$('.groupchecks:checked').length == 0 )
{
//no checked checkboxes
{
Jason Westbrook | T: 313-799-3770 | jwestbr...@gmail.com
On Sun, Mar 31, 2013 at 8:30 AM, Phil Petree phil.pet...@gmail.com
try
$$(...)
because $() equal document.getElementById
--
You received this message because you are subscribed to the Google Groups Prototype
script.aculo.us group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
Hey Jason... I guess the rest of the group are all slugs! How dare they
take Easer off! LOL
I had kinda come to the same conclusion... what I implemented was:
if($$('input:checked').length 0)
return true;
This kind of works because the ONLY input on this page are checkboxes
(think