Welcome Guest, Not a member yet? Register   Sign In
One Set of Fields or Another Required
#6

[eluser]GlenW[/eluser]
I got it working. I decided to only call it once and call it based on the Submit button's POST data (bad practise? Probably. But effective).

Code:
public function create($page = 'index')
{
        $this->form_validation->set_rules('btnSubmit', 'Submit', 'callback_required_fields');
        
        if ($this->form_validation->run() === TRUE)
        {
            $this->event_model->set_event();
            redirect(site_url());
        }
        echo "Nailed";
}

public function required_fields($str)
{
        //If timeStart AND timeStop, OR hours are not nothing, then return true.
        if ( ( $this->input->post('timeStart') != "" && $this->input->post('timeStop') != "" ) || ( $this->input->post('hours') != "" ) )
        {
            return true;
        }
        else
        {
            return false;
        }
}


Messages In This Thread
One Set of Fields or Another Required - by El Forum - 10-11-2012, 06:12 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 06:47 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 07:11 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 07:18 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 07:44 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 08:16 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 08:23 AM
One Set of Fields or Another Required - by El Forum - 10-11-2012, 08:42 PM
One Set of Fields or Another Required - by El Forum - 10-12-2012, 04:51 AM
One Set of Fields or Another Required - by El Forum - 10-12-2012, 03:42 PM
One Set of Fields or Another Required - by El Forum - 10-15-2012, 04:54 AM
One Set of Fields or Another Required - by El Forum - 10-15-2012, 04:56 AM
One Set of Fields or Another Required - by El Forum - 10-15-2012, 05:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB