[jQuery] Re: validation plugin: validation of checkboxes fail
Alexander Graef schrieb: Hi, thanks :) How would I reference the name for the rule and message preferences ? Using test[] would break the javascript, can I use 'test[]' as the key value? Sure, this is legal javascript: rules: { 'test[]': required } -- Jörn
[jQuery] Re: validation plugin: validation of checkboxes fail
Did a workaround that I should have thought of before :), using the provided submitHandler function. For those looking for a similar solution, here it is : $(#Form).validate({ submitHandler: function(form) { $(.multi).each(function(i){ var val = $(this).attr(name); $(this).attr(name, val+[]); } ); $(form).submit(); } }); Cheers Alexander -- portalZINE®- innovation uncovered http://www.portalzine.de dev. portalZINE® - all about development http://dev.portalzine.de pro. portalZINE® - customized experience http://pro.portalzine.de -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Graef Sent: Thursday, October 11, 2007 7:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: validation plugin: validation of checkboxes fail Hi, thanks :) How would I reference the name for the rule and message preferences ? Using test[] would break the javascript, can I use 'test[]' as the key value? Will give it a try. Cheers Alexander -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jörn Zaefferer Sent: Thursday, October 11, 2007 6:26 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: validation plugin: validation of checkboxes fail Alexander Graef schrieb: Hi, For the multi select: select name=test[] multiple=multiple option value=oneone/option option value=twotwo/option option value=threethree/option option value=fourfour/option option value=fivefive/option /select This allows you to pass the selected items via a form post and receive them as an array. Same applies for the checkboxes: Steak:input type=checkbox value=Steak name=food[] Pizza:input type=checkbox value=Pizza name=food[] Chicken:input type=checkbox value=Chicken name=food[] If your serverside prefers that format, thats the way to go. The 1.1 release may have a problem with those, until 1.2, please give the latest revision a try: http://dev.jquery.com/view/trunk/plugins/validate/ Regards Jörn __ NOD32 2586 (20071011) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com __ NOD32 2586 (20071011) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com
[jQuery] Re: validation plugin: validation of checkboxes fail
Alexander Graef schrieb: Hi, For the multi select: select name=test[] multiple=multiple option value=oneone/option option value=twotwo/option option value=threethree/option option value=fourfour/option option value=fivefive/option /select This allows you to pass the selected items via a form post and receive them as an array. Same applies for the checkboxes: Steak:input type=checkbox value=Steak name=food[] Pizza:input type=checkbox value=Pizza name=food[] Chicken:input type=checkbox value=Chicken name=food[] If your serverside prefers that format, thats the way to go. The 1.1 release may have a problem with those, until 1.2, please give the latest revision a try: http://dev.jquery.com/view/trunk/plugins/validate/ Regards Jörn
[jQuery] Re: validation plugin: validation of checkboxes fail
Hi, thanks :) How would I reference the name for the rule and message preferences ? Using test[] would break the javascript, can I use 'test[]' as the key value? Will give it a try. Cheers Alexander -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jörn Zaefferer Sent: Thursday, October 11, 2007 6:26 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: validation plugin: validation of checkboxes fail Alexander Graef schrieb: Hi, For the multi select: select name=test[] multiple=multiple option value=oneone/option option value=twotwo/option option value=threethree/option option value=fourfour/option option value=fivefive/option /select This allows you to pass the selected items via a form post and receive them as an array. Same applies for the checkboxes: Steak:input type=checkbox value=Steak name=food[] Pizza:input type=checkbox value=Pizza name=food[] Chicken:input type=checkbox value=Chicken name=food[] If your serverside prefers that format, thats the way to go. The 1.1 release may have a problem with those, until 1.2, please give the latest revision a try: http://dev.jquery.com/view/trunk/plugins/validate/ Regards Jörn __ NOD32 2586 (20071011) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com
[jQuery] Re: validation plugin: validation of checkboxes fail
Alexander Graef schrieb: [...] This is a wrong scenario, as normally each checkbox has its own unique name within a form. The validation fails if the names are different for each checkbox. How do I chain them for validation with each checkbox having its own name ? [...] I have no idea how to identify a group of checkboxes without a common name. And this is the first time I read that checkboxes need a unique name. The HTML spec (http://www.w3.org/TR/html401/interact/forms.html#checkbox) says: Several checkboxes in a form may share the same control name. http://www.w3.org/TR/html401/interact/forms.html#control-name Thus, for example, checkboxes allow users to select several values for the same property. Could you recheck your resources? -- Jörn
[jQuery] Re: validation plugin: validation of checkboxes fail
Hi, For the multi select: select name=test[] multiple=multiple option value=oneone/option option value=twotwo/option option value=threethree/option option value=fourfour/option option value=fivefive/option /select This allows you to pass the selected items via a form post and receive them as an array. Same applies for the checkboxes: Steak:input type=checkbox value=Steak name=food[] Pizza:input type=checkbox value=Pizza name=food[] Chicken:input type=checkbox value=Chicken name=food[] When I said, a unique name is required, I was not refering to the specs, but to the retrieval of information. So either allow the values to be passed as an array or use an unique name for each and allow the grouping of them with another attribute for validation. Cheers Alexander -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jörn Zaefferer Sent: Wednesday, October 10, 2007 8:30 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: validation plugin: validation of checkboxes fail Alexander Graef schrieb: [...] This is a wrong scenario, as normally each checkbox has its own unique name within a form. The validation fails if the names are different for each checkbox. How do I chain them for validation with each checkbox having its own name ? [...] I have no idea how to identify a group of checkboxes without a common name. And this is the first time I read that checkboxes need a unique name. The HTML spec (http://www.w3.org/TR/html401/interact/forms.html#checkbox) says: Several checkboxes in a form may share the same control name. http://www.w3.org/TR/html401/interact/forms.html#control-name Thus, for example, checkboxes allow users to select several values for the same property. Could you recheck your resources? -- Jörn __ NOD32 2584 (20071010) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com