The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Checkbox validation with JS (RSV) - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18) +--- Thread: Checkbox validation with JS (RSV) (/showthread.php?tid=740) |
Checkbox validation with JS (RSV) - ebirer - Jun 10th, 2010 Hi there, I want to validate a checkbox group with JS, but when i use the statement: Code: rules.push("required,accomodationtype[],Please check all that apply"); Code: <INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_0" value="hotel1">Hotel1<BR> It doesn't validate and it immediately posts the form. I am not sure if i am doing something wrong. Can anybody help this situation? Thanks in advance.. I found the solution by myself I forgot the slashes, it needs to be like this: Code: rules.push("required,accomodationtype\[\],Please check all that apply"); RE: Checkbox validation with JS (RSV) - waizen - Sep 2nd, 2010 This looks like it's on the right track for a situation I'm having, except for one thing: the name="whatever" within each check box input seems to need to be the same across the check box group in order for the validation to work. In my case, though, I need for each checkbox to still act independently of each other...needing to have different names attached to each. Long story why...let's just say I have a 3rd party app form tools needs to interact with that requires different database tables...one for each check box data. Any way to group a set of check boxes to validate as a group, but still maintain their individuality? Did that question make sense? RE: Checkbox validation with JS (RSV) - mary123 - Feb 6th, 2011 Hi, I placed the csv file on the server and created a php file with the recommended codes. However, when I filled out the form and clicked on Submit, the entries were gone but I didn't see the 'Successfully Saved' message, and of course there was no entry into the csv file. Also when I tested leaving out some fields and clicked on Submit, I did not get the error message in the code. However, I have php 5.11 installed on the computer and all the php forms for another website work well. Do you have any idea what had gone wrong on my side? Thanks!! RE: Checkbox validation with JS (RSV) - QuintonMedina - Mar 28th, 2011 Excellent post.I want to thank you for this informative. I really appreciate sharing this great post. RE: Checkbox validation with JS (RSV) - JMW - Apr 18th, 2011 Thanks, I was wondering how to verify if any checkbox selections had been made. Works fine for me so far. |