Welcome Guest, Not a member yet? Register   Sign In
validation problem
#1

[eluser]alberta[/eluser]
hi,

I am using form validation, but error message is not displayed Sad
this is the code

view file
Code:
<table class="{class}">
&lt;?php echo $this->validation->error_string; ?&gt;
&lt;form name="editplan" action="{site_url}index.php/projects/plan_edited" method="post" &gt;
<tbody>
    <th colspan="2">{id} - {definition}</th>


</tr>
   <td align="right">&nbsp;</td>
    <td >
   &lt;input value="Commit"  type="button"&gt;
   </td>
</tbody>
&lt;/form&gt;
</table>

controller file

Code:
function edit_plan($plan_id)
    {
        $data = tags();
        $data['tabs']    = tabs('projects');
      
        // get the list of stages
        $data['states']= $this->projects_model->get_nominal_plan($limit, $this->uri->segment(4), $plan_id);
        
    
            // if i don't set it here too, it gives error of  Message: Undefined property: CI_Validation::$commit    
        $rules['commit']        = "required";
        $this->validation->set_rules($rules);
            $fields['commit']    = 'Commit';
        $this->validation->set_fields($fields);
        
            $this->parser->parse('projects/edit_plan', $data);  
    }
    function plan_edited()
    {
        $this->load->helper( 'form' );
            $this->load->helper( 'url' );
        $this->load->library('validation');
        $rules['commit']        = "required";

        $this->validation->set_rules($rules);
        $fields['commit']    = 'Commit';
            $this->validation->set_fields($fields);
        if ($this->validation->run() == FALSE)
        {
                 // redirects on form page
         $pieces = explode("index.php", $_SERVER['HTTP_REFERER']);
         redirect($pieces[1]);
        }
        
    }
Note: this is an edit form


Messages In This Thread
validation problem - by El Forum - 08-08-2009, 11:41 AM
validation problem - by El Forum - 08-08-2009, 12:50 PM
validation problem - by El Forum - 08-09-2009, 01:32 AM
validation problem - by El Forum - 08-09-2009, 03:10 AM
validation problem - by El Forum - 08-14-2009, 03:35 AM
validation problem - by El Forum - 08-14-2009, 05:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB