Welcome Guest, Not a member yet? Register   Sign In
Form Validation help
#2

i already do something like that.

this is my code from scratch

PHP Code:
if ($this->input->post('send')) {
            
$this->load->library('form_validation');
            
$index 0;
            for (
$index 0$index 100; ++$index) {
                if (
$this->input->post('host_'.$index.'_templateid') != '') {
                    if (
$this->input->post('host_'.$index.'_zabbix_integration')) {
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_templateid',
                            
'Choix du template ligne '.$index,
                            
'required|is_natural_no_zero'
                        
);
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_ip',
                            
'Adresse IP ligne '.$index,
                            
'required|valid_ip'
                        
);
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_suffixe',
                            
'Suffixe ligne '.$index,
                            
'required'
                        
);
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_location',
                            
'Emplacement ligne '.$index,
                            
'required'
                        
);
                    } else {
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_suffixe',
                            
'Suffixe ligne '.$index,
                            
'required'
                        
);
                        
$this->form_validation->set_rules(
                            
'host_'.$index.'_location',
                            
'Emplacement ligne '.$index,
                            
'required'
                        
);
                    }
                }
            }

            if (
$this->form_validation->run() === true) {
                    
// do you insert/update
            
}

Reply


Messages In This Thread
Form Validation help - by garisous - 03-03-2016, 01:45 AM
RE: Form Validation help - by keulu - 03-03-2016, 03:45 AM
RE: Form Validation help - by garisous - 03-03-2016, 08:21 AM
RE: Form Validation help - by Wouter60 - 03-03-2016, 09:35 AM
RE: Form Validation help - by garisous - 03-03-2016, 09:50 AM
RE: Form Validation help - by keulu - 03-04-2016, 01:32 AM
RE: Form Validation help - by garisous - 03-04-2016, 10:45 AM
RE: Form Validation help - by garisous - 03-04-2016, 01:05 PM
RE: Form Validation help - by garisous - 03-04-2016, 01:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB