Welcome Guest, Not a member yet? Register   Sign In
I need your way of doing form validation
#1

[eluser]djuric[/eluser]
I need to do form validation, I even did something like this on one of the validation cases:

Code:
if($this->input->post('submitted') =='yes') { // this is hidden field in the form
    
if($this->form_validation->run() === TRUE) {
  $ovca['success'] = TRUE;
  $this->admin_model->update_duela($duel_id);
} else {
  $ovca['success'] = FALSE;
}
    
}

and in view like:

Code:
if($success) {
        echo "Your post has been submitted!";
} else {
        echo validatoin_errors();
}



Validation errors is great, I use it when validation fails. But when validation passes and form is submitted successfully, I usually do something like above.

Also, I could do something like this directly in view:

Code:
if($this->form_validation->run() === TRUE) {
   echo "Your post has been submitted!";
} else {
   echo validation_errors();
}

but it's not nice to do it in view. Is it?

Thanks for any suggestions



Messages In This Thread
I need your way of doing form validation - by El Forum - 07-01-2012, 05:16 PM
I need your way of doing form validation - by El Forum - 07-01-2012, 07:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB