Closed takyam-git closed 11 years ago
$val = Validation::forge(); $val->add_field('files.0.name', 'file name 0', 'required'); $val->add_field('files.1.name', 'file name 1', 'required'); //not posted but need validation parameters. (ex $_FILES) $not_posted_parameters = array( 'files' => array( '0' => array( 'name' => 'file0.jpg', ), '1' => array( 'name' => 'file1.jpg', ), ), ); $val->run($not_posted_parameters); //false
expected return is true, but it's returned false. but parameters if in post and set 1st argument of run(), returned true.
true
false
$_POST = $not_posted_parameters; $val->run(); // false $val->run($not_posted_parameters); //true
workaround solution is
$flatten_parameters = Arr::flatten($not_posted_parameters, '.'); $val->run($flatten_parameters); //true
thanks!!
Btw: The run method is completly missing in the docs: http://fuelphp.com/dev-docs/classes/validation/methods.html
See https://github.com/fuel/docs/issues/73
expected return is
true
, but it's returnedfalse
. but parameters if in post and set 1st argument of run(), returned true.workaround solution is