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

(This post was last modified: 10-27-2015, 01:22 PM by Avenirer.)

(10-21-2015, 12:37 PM)SRGreenwood Wrote:
(10-18-2015, 11:48 PM)Avenirer Wrote: The email rule should not return any error as there is no "required" rule in there. The only problem should be with the phone rule.

My understanding is the same as yours.  You add "required" if an empty response should be an error. phone is a rule I have added that matches a US phone number, much like valid_email matches an email address.

Both valid_email and phone report an invalid email and invalid phone number when given blank input IN THIS CONTEXT.  Forms elsewhere on the site that use these rules do not report an error.  What seems to be unique to the non-working case is that the "variable" name is an array element (eg opt[3]) rather than a scalar (eg xxx).

I guess I need to code up an example to illustrate what I think is erroneous behavior.  I'll look into it at some point.

Now I understand what you mean. You should try this
```
$this->form_validation->set_rules('phone[]','Phone','your_validation_conditions_here');
Reply


Messages In This Thread
RE: CI 2.2 Form Validation not working as expected - by Avenirer - 10-27-2015, 01:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB