Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
I am missing something
  • I am trying to output an error message to a template using <code>$this->template->error = $val->show_errors();</code> where $val is a validation class object. What I am getting is sanitized text in my error output rather then an ordered list like I expected. I know I am missing something here but for the life of me I can't find the answer.
  • It uses the config in the config/validation.php file to generate the result. Perhaps something wrong there?
  • I am no expert, but the problems seems to be that the variables within the Template controller $this->template->somevariable are sanitized by default. I can not figure out how to not have the template variable sanitized. For a standard controller I saw in the docs the $view->set('info', $val->show_errors(), false); functionality, but I can not seem to get it to work for a template variable. Attached is the full code that I am trying to figure out. In the template I have a message div that catches all of the messages to my users. It is not in the individual view, but rather the master template. I really need to figure this out. I am working on a project for my school district (I am a teacher). $data = array(); if ($_POST)
    {
    $val = Validation::forge();
    $val->add_field('new_pass', 'New Password', 'required|trim|min_length[4]|max_length[10]|match_field[confirm_pass]');
    $val->add_field('confirm_pass', 'Confirm Password', 'required');
    if ($val->run())
    $this->template->info = 'Password Changed Successfully!';
    else
    $this->template->error = $val->show_errors();
    } $this->template->content = View::forge('student/password/change', $data, false);
  • I feel like an idiot. I must have been more tired then I thought last night. $this->template->set('error', $val->show_errors(), false); does set non sanitized template variable as per the documentation. Palm meet face ...

Howdy, Stranger!

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

In this Discussion