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

[eluser]GlenW[/eluser]
Hello all, first post here.

I have a project that I'm working on and am quite stumped by the best way to go about it.

I have three fields in a form that needs to be submitted. timeStart, timeStop and hours.

I would like a form_validation rule that requires timeStart AND timeStop to be filled in, or hours, or both.

For testing I tried just having it redirect to other pages to let me know where it was getting:

Code:
$this->form_validation->set_rules('timeStart', 'Time Start', 'required');
        $this->form_validation->set_rules('timeStop', 'Time Stop', 'required');

        if ( $this->form_validation->run === TRUE )
        {
            redirect("http://seatingisbelieving.com");
        }
        else
        {
            $this->form_validation->set_rules('hours', 'Hours', 'required');
            if ( $this->form_validation->run === TRUE )
            {
                redirect("http://google.ca");
            }
            else
            {
                redirect("http://outlook.com");
            }
        }

I'm assuming that the call to the run function under form_validation does not clear previous rules, which is part of my problem.

Any help would be greatly appreciated.


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