Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validation class: required at least one of two fields
  • Hi guys, Just wondering if the validation class offers the functionality to have at least one of 2 fields required? Practical example would be to have a name field and an email field, and requiring the user to fill in at least one: - only name is correct
    - only email is correct
    - both name and email is correct
    - when both aren't supplied it would result in an error. Or should this be done in a Validation extension? Then the follow-up question: what's the desired way to do this check, as the example in the Docs demonstrates that the validation function only receives the value of the current field we're validating. Thanks in advance!
  • Hi, Either make both required or do the is one or the other filled in validation checks in you controller.
    Phil.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion