Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Validate field based on another fields setting
dpweberza
November 2012
Hi,
Is it possible to validate a field based off what another fields value is?
For instance, I need to validate that an email address is specified if the field contact_type is email.
I'm pretty sure there is no rule built in for this, but would it even be possible with a custom rule?
Possibly using Input::post() directly? (I think to myself as writing I'm this)
Otherwise I suppose I will just have write my own validation class, but I'd prefer to be able to validate a model with access to all its values.
Harro
November 2012
You can do that in the validation rule.
"match_field" and "required_with" are two examples of existing validation rules that validate based on a second field value.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
November 2012