Welcome Guest, Not a member yet? Register   Sign In
single error message for all the validations?
#2

(This post was last modified: 01-07-2016, 05:34 AM by Diederik.)

You could use the error_array() function for this purpose.

PHP Code:
$error_array $this->form_validation->error_array();
if (
is_array($error_array ) && !empty($error_array)) {

 
   // Generate a single message for all fields combined:
 
   echo '<div class="error">Something is wrong with the form values.</div>';

 
   // Or loop through the errors and output a message per fieldname
 
   foreach($error_array  as $fieldname => $message) {
        
// The $message variable contains the message you want to hide
 
       echo '<div class="error">There is a problem with the value for the ' $fieldname ' field.</div>';
 
   }


Reply


Messages In This Thread
RE: single error message for all the validations? - by Diederik - 01-07-2016, 05:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB