Welcome Guest, Not a member yet? Register   Sign In
Codeigniter blog application bug: form is loaded without validation errors
#2

You need to combine edit and update. If you look at my example below I'm saving it inside run() and loading the form inside "else".

PHP Code:
public function update$group_id )
{
    
$this->VALID_UUIDv4($group_id);
    
    
$this->data['group'] = $this->group_model->get($group_id);
    if( empty(
$this->data['group']) ) { show_404(); }
    if( 
$this->data['group']->company_id !== $this->auth_company_id ) { show_404(); }
    
    
$this->load->helper('form');
    
$this->load->library('form_validation');
    
$this->config->load('form_validation');
    
$validation_rules $this->_get_rules_update();
    
    
$this->form_validation->set_rules$validation_rules );
    if( 
$this->form_validation->run() === TRUE )
    {
        if ( 
$this->group_model->update$this->data['group'] ) === TRUE )
        {
            
redirect('admin/groups');
        }
    }
    else
    {
        
$this->load->view('admin/groups/update',$this->data);
    }

Reply


Messages In This Thread
RE: Codeigniter blog application bug: form is loaded without validation errors - by jreklund - 01-05-2019, 01:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB