[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