if (Input::method() == 'POST') { $val = Validation::factory('offer'); $val->add('offer_value', 'Value')->add_rule('required'); if($val->run()) { Session::set_flash('notice', 'passed...'); } else { echo 'Size '.count($val->errors()); echo '<pre;>'; print_r($val->errors()); echo '</pre>'; return; Session::set_flash('notice', $val->errors()); }
Array ( [offer_value] => Fuel\Core\Validation_Error Object ( [field] => Fuel\Core\Fieldset_Field Object ( [fieldset:protected] => Fuel\Core\Fieldset Object ( [name:protected] => offer [fields:protected] => Array ( [offer_value] => Fuel\Core\Fieldset_Field Object *RECURSION* ) [validation:protected] => Fuel\Core\Validation Object ( [fieldset:protected] => Fuel\Core\Fieldset Object *RECURSION* [input:protected] => Array ( [offer_value] => ) [validated:protected] => Array ( ) [errors:protected] => Array *RECURSION* [callables:protected] => Array ...... a couple of hundred more lines like the above..... [previous:Exception:private] => [xdebug_message] => ( ! ) Fuel\Core\Validation_Error: in C:\wamp\www\dev\fuellogin\fuel\core\classes\validation.php on line 309 Call Stack #TimeMemoryFunctionLocation 10.0006395368{main}( )..\index.php:0 20.01681515552Fuel\Core\Request->execute( )..\index.php:42 30.04593807784call_user_func_array ( )..\request.php:429 40.04593807968Controller_Companies->action_add_offer( )..\request.php:0 50.05754978048Fuel\Core\Validation->run( )..\companies.php:151 60.05764978944Fuel\Core\Validation->_run_rule( )..\validation.php:277In the base view:
<?=render('companies/_offer_form', array('company_id' => $company->id));?>
<h3>Offer</h3> <div> <?=Form::open('companies/add_offer/'.$company_id);?> <p> <?=Form::label('Probability', 'offer_probability');?> Low<?=Form::radio('offer_probability', 'Low', array('checked'));?> Medium<?=Form::radio('offer_probability', 'Medium');?> High<?=Form::radio('offer_probability', 'High');?> </p> <p> <?=Form::label('Value', 'offer_value');?> <?=Form::input('offer_value', Input::post('offer_value', ''), array('autocomplete' => 'off'));?> </p> <p> <?=Form::label('Contactdate', 'offer_contactdate');?> <?=Form::input('offer_contactdate', Input::post('offer_contactdate', ''), array('autocomplete' => 'off'));?> </p> <p> <?=Form::label('Comment', 'offer_comment');?> <?=Form::textarea('offer_comment', Input::post('offer_comment', ''), array('cols' => 40, 'rows' => 4));?></p> <div class="actions"> <?=Form::submit();?> </div> <?=Form::close();?> </div>
Session::set_flash('notice', $val->errors())
It looks like you're new here. If you want to get involved, click one of these buttons!