Re: [Proto-Scripty] determine if any of checkbox[] is checked

2013-04-01 Thread Jason Westbrook
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)

Re: [Proto-Scripty] determine if any of checkbox[] is checked

2013-04-01 Thread Phil Petree
// 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(

Re: [Proto-Scripty] determine if any of checkbox[] is checked

2013-04-01 Thread Jason Westbrook
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

Re: [Proto-Scripty] determine if any of checkbox[] is checked

2013-04-01 Thread Phil Petree
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