Welcome Guest, Not a member yet? Register   Sign In
Form validation using array of fields
#1

[eluser]Gaz[/eluser]
Hi all,

I have three forms on a page, with each set of fields grouped into an array. Two of the rule I have are as follows:

Code:
[9]=>
  array(3) {
    ["field"]=>
    string(18) "security[password]"
    ["label"]=>
    string(8) "Password"
    ["rules"]=>
    string(8) "required"
  }
  [10]=>
  array(3) {
    ["field"]=>
    string(25) "security[confirmPassword]"
    ["label"]=>
    string(16) "Confirm Password"
    ["rules"]=>
    string(38) "required|matches[security[password]]"
  }

Rule 10 always fails, because the matches rule cannot find
Code:
security[password]
field in the POST array, as it looks for
Code:
$_POST['security[password]']
not
Code:
$_POST['security']['password']

Is there any way to pass array parameters to the form validation rules so that they do work?

Cheers,
Gaz.




Theme © iAndrew 2016 - Forum software by © MyBB