Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Input fields are automatically 'required' when using other validation rules and submitting using array syntax #113

Closed
bitbucket-import opened this Issue · 3 comments

4 participants

@bitbucket-import

Bug and patch initially described here:
http://codeigniter.com/forums/viewthread/159243/

Consider an input field

{{{

}}}

and validation rules

{{{
$this->form_validation->set_rules('email', 'email', 'valid_email');
}}}

If the form is submitted with a blank email field, it will validate correctly (no errors).

Now consider using POST array syntax, pretty common scenario

{{{

}}}

and the same validation rule

{{{
$this->form_validation->set_rules('user[email]', 'email', 'valid_email');
}}}

Now if the form is submitted with a blank email field, it is invalid. It displays the error "The email field must contain a valid email address."

Clearly, I didn't state this field was also required.

Simple one-line fix, provided on the link above. I have committed this to my fork here if you would like to pull it:

https://bitbucket.org/adrianmacneil/codeigniter-reactor

@hanneskaeufler

This one got me into trouble today! Is fix coming?

@philsturgeon

This has a pull request, so closing.

@narfbg
Owner

It's been a long time and that pull request hasn't been merged yet, so ... reopening as a reminder.

@narfbg narfbg reopened this
@narfbg narfbg closed this
@narfbg narfbg reopened this
@narfbg narfbg closed this issue from a commit
@narfbg narfbg Fix #113 2d48b4f
@narfbg narfbg closed this in 2d48b4f
@nonchip nonchip referenced this issue from a commit in nonchip/CodeIgniter
@narfbg narfbg Fix #113 9df1500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.