Welcome Guest, Not a member yet? Register   Sign In
Validate input of two possible arrays
#2

(This post was last modified: 01-29-2020, 11:21 AM by jreklund.)

You can set an custom callback on whatever field you want. For e.g. on the group_id. And in that custom callback grab both arrays and do your checks. Post are always available (in controller and model).

PHP Code:
public function check_groups()
{
    
$add_to_group $this->input->post('add_to_group');
    
$remove_from_group $this->input->post('remove_from_group');

    if(
$checks_valid)
         return 
true;

    return 
false;


And depending on what fails, send custom error codes.
PHP Code:
$this->form_validation->set_message('check_groups''Add to group error');
$this->form_validation->set_message('check_groups''Remove to group error');
$this->form_validation->set_message('check_groups''No group selected?!'); 
Reply


Messages In This Thread
Validate input of two possible arrays - by dwlamb - 01-28-2020, 03:32 PM
RE: Validate input of two possible arrays - by jreklund - 01-29-2020, 11:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB