CodeIgniter Forums
Validation Error being Processed but not displayed. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Validation Error being Processed but not displayed. (/thread-1861.html)



Validation Error being Processed but not displayed. - El Forum - 07-01-2007

[eluser]maffo[/eluser]
Please just take this example as there might be a simple answer Im not aware of.

Code:
function extra_fields($form,$data)
    { $this->load->library('validation');
      $sql = "SELECT * FROM prefix_extra_fields WHERE form = '".$form."'";
      $query = $this->db->query($sql, array());
      $build ="";  //gives build an initial value of blank
        
            foreach ($query->result() as $row)
            {     //  text input
                if($row->type=="text"){  
                  
                    $name=$row->name;
                     $error_validation = $name."_error";
                $build.='<tr>
                             <td class="form_label">'.$name.':</td>
                            <td class="form_input">'.$this->validation->$error_validation.'&lt;input type="text" name="'.$name.'" value="'.$this-&gt;validation->$name.'" size="50" /></td>    
                         </tr>';
                 }// end text input
RETURN $build;
}

What this example does is gets any extra fields for this particular form as $form lets say 'user_register'.

I have a validation system running and working but the error message will not parse to the view.

In the above code example '$this->validation->$name' is being parsed to the view, no problem, but $this->validation->$error_validation will not parse.

Lets say $error_validation = 'username_error', this simply does not parse the expected error to my view. However if I placed the code $this->validation->username_error directly into my view page, any error can be seen, so Im certain the validation system I have is working 100%.

If anyone who is clever knows why a validation_error cant be parsed from a function then please let me know. This is almost complete now and I am willing to share the system... if I can get it to work properly.


Validation Error being Processed but not displayed. - El Forum - 07-01-2007

[eluser]maffo[/eluser]
Problem fixed,

Code:
$this->validation->run();

Added this to my validation function