Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Validation->add_field does not accept rules as array
  • Hi, Anyone knows why the documentation says that $rules can be an array of rules? add_field($name, $label, $rules) $rules mixed
    None
    The set of validation rules with (optional) rule parameters grouped in square brackets, and separated with commas. It can be passed as a string where the rules are separated with a vertical bar or pipe symbol (|), or as a array of rules. http://docs.fuelphp.com/classes/validation/methods.html But in my version of fuel (1.0/1.1), this method starts like this: /**
    * Simpler alias for Validation->add()
    *
    * @param string Field name
    * @param string Field label
    * @param string Rules as a piped string
    * @return Fieldset_Field $this to allow chaining
    */
    public function add_field($name, $label, $rules)
    {
    $field = $this->add($name, $label); $rules = explode('|', $rules);
    foreach ($rules as $rule) So clearly that's never gonna accept an array as $rule. Thanks,
    Jakob
  • The docs reflect the latest released version, which at the moment is 1.2RC1. This is obviously a feature that has been introduced in 1.2, and is not present in 1.1.

Howdy, Stranger!

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

In this Discussion