Welcome Guest, Not a member yet? Register   Sign In
validation errors output
#4

[eluser]kirkaracha[/eluser]
I display the errors at the top of my form views like this:
Code:
<?php if(isset($page_type) && $page_type=='form'){
    $this->load->view('shared/display_error_messages',$data);
    // don't show the required fields notice on deletion confirmation forms
    if(!strpos($page_title,'delete')) {
        echo '<p class="note"><strong>Bold</strong> fields are required.</p>' . "\r\r";
    }
} ?&gt;
The shared/display_error_messages view:
Code:
&lt;?php
if(isset($this->validation->error_string)){
    if(count($this->validation->_error_array) > 0) {
        $display = '<div id="errors">' . "\r\r";
        $display .= "<p>Sorry, we had some trouble with your form.</p>\r\r";
        $display .= "<ul>\r";
        $display .= $this->validation->error_string;
        $display .= "</ul>\r";
        $display .= "</div>\r\r";

        echo $display;
    }
}
?&gt;


Messages In This Thread
validation errors output - by El Forum - 07-30-2007, 05:23 PM
validation errors output - by El Forum - 07-30-2007, 05:26 PM
validation errors output - by El Forum - 07-30-2007, 06:42 PM
validation errors output - by El Forum - 07-31-2007, 03:49 PM
validation errors output - by El Forum - 07-31-2007, 03:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB