Welcome Guest, Not a member yet? Register   Sign In
Form validation: Callback not changing the input value
#28

[eluser]coolgeek[/eluser]
That's not it... you'll note that my controller calls a model to insert a record and the record does in fact insert, with a value of 'test award'.

In fact, this silly callback function was created in order to try to debug my real problem, which is with form_dropdown. I have another callback function:

Code:
function date_check () {
    if (isset($_POST['month']) && isset($_POST['day']) && isset($_POST['year'])
        && $_POST['month'] != 0 && $_POST['day'] != 0 && $_POST['year'] != 0) {
        if (checkdate($_POST['month'], $_POST['day'], $_POST['year']))
            return TRUE;
        else
        {
            $this->form_validation->set_message('date_check', 'The date field is invalid');
            return FALSE;
        }
    }
    else
    {
        $this->form_validation->set_message('date_check', 'The date field is invalid');
        return FALSE;
    }
}

that I'm calling as such (in the controller)

Code:
$this->form_validation->set_rules('year', 'Year', 'trim|required|xss_clean|callback_date_check');

I'm setting the form_input field to 'test award', and not setting the form_dropdown fields at all. When I click the submit button, not only is the record being created with the name 'test award', but the date is being set to '0000-0-0'

For all intents and purposes, the callback_award_check was copied directly from the Form Validation doc page, which is why I find this so frustrating

EDIT: fwiw, here is the generated html

Code:
<div id="award" class="inputformtext"><p>Award:&lt;input type="text" name="award" value="" size=""  /&gt;


Messages In This Thread
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:08 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:13 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:16 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:24 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:27 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:35 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:38 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:42 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:43 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:58 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:05 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:20 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:33 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:21 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:24 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:49 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 01:31 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 01:38 PM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 08:50 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:20 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:52 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:59 AM
Form validation: Callback not changing the input value - by El Forum - 07-16-2009, 10:27 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 08:23 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 09:42 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:00 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:18 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:58 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 12:26 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 01:53 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 04:21 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 05:50 PM
Form validation: Callback not changing the input value - by El Forum - 09-03-2009, 12:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB