[eluser]CIfan1000[/eluser]
Hi guys!
I have the following in a controller:
Code:
// Define the validation rules for each field:
// The names must be the field names in the form:
$rules['RegisterUsername'] = "trim|required|min_length[5]|max_length[12]|xss_clean|alpha_dash";
$rules['RegisterUserEmail'] = "trim|required|valid_email";
$rules['RegisterUserPassword'] = "trim|required|min_length[5]|max_length[12]|xss_clean|alpha_dash|md5";
$rules['RegisterUserPassword2'] = "trim|required|min_length[5]|max_length[12]|xss_clean|matches[RegisterUserPassword]|alpha_dash|md5";
$rules['CheckboxUserAgreement'] = "callback_CheckboxUserAgreement_validate";
And then later in the same controller:
Code:
// ----------------------------------------------------------------------------
// Define callback function used in validation above:
function CheckboxUserAgreement_validate($str)
{
// Check if the CheckboxUserAgreement is checked:
if (isset ($_POST ["CheckboxUserAgreement"]))
{
echo "true";
return TRUE;
}
else
{
$this->validation->set_message('CheckboxUserAgreement_validate', 'You must agree to the User Agreement');
return FALSE;
}
// End of CheckboxUserAgreement_validate function
}
But the callback function does not seem to get called.
Any assistance or other suggestions as to how to validate a single checkbox would be very much appreciated. Thanks!