Welcome Guest, Not a member yet? Register   Sign In
Trouble with set_value() & callback form validation
#1

[eluser]lennierb5[/eluser]
I have the following set_rules for my form validation:
Code:
$this->form_validation->set_rules('code_1', 'Billing Code #1','trim|alpha_numeric|callback__validate_billing_codes');

The function it calls back to:

Code:
function _validate_billing_codes() {
        if ($this->input->post('code_1') || $this->input->post('code_7') ||
            $this->input->post('code_2') || $this->input->post('code_8') ||
            $this->input->post('code_3') || $this->input->post('code_9') ||
            $this->input->post('code_4') || $this->input->post('code_10') ||
            $this->input->post('code_5') || $this->input->post('code_11') ||
            $this->input->post('code_6') || $this->input->post('code_12')) {
            $query = $this->db->query('SELECT billing_codes.Codes FROM billing_codes');
            $i = 1;
            while ($i <= 12) {
            if ($_POST['code_'.$i.'']) {
            $_POST['code_'.$i.''] = strtoupper($_POST['code_'.$i.'']);
            if (!in_multiarray($_POST['code_'.$i.''],$query->result_array())) {
                $this->form_validation->set_message('_validate_billing_codes', 'Billing code #'.$i.' is not a valid billing code.');
                return FALSE;
                } } $i++;}
            } else {
            return TRUE; } }

Now my problem is when I try to echo set_value('code_1'); It only works if there were no other validation errors before it on the form. But I can access the value using $_POST['code_1']; set_value 2-12 work just fine with no problems it is only code_1 that has trouble. Any suggestions as to why this is happening? I am temporarily using the $_POST['code_1'] solution.


Messages In This Thread
Trouble with set_value() & callback form validation - by El Forum - 11-24-2010, 02:20 PM
Trouble with set_value() & callback form validation - by El Forum - 11-25-2010, 07:40 AM
Trouble with set_value() & callback form validation - by El Forum - 11-26-2010, 11:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB