Array passes form validation for string element with the same name -- how to fix? |
I've set up form validation for (amongst other fields) a text input box with the name "cms", this is in my application\config\form_validation.php file:
// ... array( 'field' => 'cms', 'label' => 'CMS', 'rules' => 'is_natural_no_zero' ), // ... If I use a regular <input name="cms" value="value"> this works fine. Yet, if I tweak the html for the form, and send a "cms" array to the controller instead of a string value, like this <input name="cms[]" value="some"><input name="cms[]" value="other"> this array passes the validation rule! Which is not what I want, nor what I expected. I would expect (and want) the form validation to fail if an array instead of a string value was submitted. Is there a way to enforce this in CodeIgniter (using validation rules)? |
Messages In This Thread |
Array passes form validation for string element with the same name -- how to fix? - by Stanzi1791 - 09-25-2018, 01:55 PM
RE: Array passes form validation for string element with the same name -- how to fix? - by dave friend - 09-25-2018, 09:04 PM
RE: Array passes form validation for string element with the same name -- how to fix? - by Stanzi1791 - 09-26-2018, 02:47 AM
|