Welcome Guest, Not a member yet? Register   Sign In
CI 2.2 Form Validation not working as expected
#1

This is CI 2.2.3
I'm using an array for the name of a set of input values 'opt' (ie opt[1] opt[2] ...).
Here is a dump of the validation config array passed to form_validation->set_rules().  
As you can see the some of the input are required but fields Email and Phone are not.  Email is using a CI supplied function (valid_email) while Phone is using a function in our MY_form_validation class.

If no input is supplied for the Email and Phone input field no error should be issued, but one is.
This looks like a bug to me.

TEST - 2015-10-18 10:16:34 --> Array
(
   [0] => Array
       (
           [field] => opt[1]
           [label] => Team Manager Name
           [rules] => trim|required|max_length[50]
       )
   [1] => Array
       (
           [field] => opt[2]
           [label] => Team Kind
           [rules] => trim|required|max_length[50]
       )
   [2] => Array
       (
           [field] => opt[4]
           [label] => Email
           [rules] => trim|valid_email
       )
   [3] => Array
       (
           [field] => opt[3]
           [label] => Phone
           [rules] => trim|phone
       )
)
Reply


Messages In This Thread
CI 2.2 Form Validation not working as expected - by SRGreenwood - 10-18-2015, 07:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB