EllisLab text mark
Advanced Search
     
Validation Error being Processed but not displayed.
Posted: 01 July 2007 07:50 PM   [ Ignore ]
Joined: 2007-05-29
13 posts

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
                
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.'<input type="text" name="'.$name.'" value="'.$this->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.

 Signature 

Classified-Software - PHP Classified Ads Script Program

 
Posted: 01 July 2007 08:30 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-05-29
13 posts

Problem fixed,

$this->validation->run(); 

Added this to my validation function

 Signature 

Classified-Software - PHP Classified Ads Script Program