CodeIgniter Forums

Full Version: Validation Error being Processed but not displayed.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Please just take this example as there might be a simple answer Im not aware of.

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
                     $error_validation = $name."_error";
                             <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>    
                 }// 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.

El Forum

Problem fixed,


Added this to my validation function