Welcome Guest, Not a member yet? Register   Sign In
Validation callback that changes value doesn't work on arrays?
#5

[eluser]siptik[/eluser]
You must do validation for each field.
For example:
Code:
$this->form_validation->set_rules("v[a]", 'Foo Field Name', 'callback_change_foo');
    $this->form_validation->set_rules("v[b]", 'Foo Field Name', 'callback_change_foo');
    $this->form_validation->set_rules("v[c]", 'Foo Field Name', 'callback_change_foo');

    public function change_foo($foo)
    {
       return "some new value for $foo";
    }

<form method="post" action="">
    <input name="v[b]" type="text">
     <input name="v[a]" type="text">
     <input name="v[c]" type="text">
     <input name="add" type="submit">
</form>

result:
Array ( [v] => Array ( [b] => some new value for sdf [a] => some new value for aaa [c] => some new value for ssss ) [add] => Отправить )


Messages In This Thread
Validation callback that changes value doesn't work on arrays? - by El Forum - 09-10-2012, 12:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB