Welcome Guest, Not a member yet? Register   Sign In
validation callback rules and dynamic text in the error mesage
#1

[eluser]deanf7[/eluser]
I'm using call back function to validate that if a user checks a specific textbox they also enter text in the accompanying input field. There are a number of such fields in my form, and I didn't want to write a callback for each one. It correctly generates the error for each field, but it won't print the custom text

Here's the code for the call back:
Code:
function checkActivities($activity, $time_spent) {
   if(isset($activity) && $time_spent != '') {
    return true;
   }
   $this->form_validation->set_message('checkActivities', "If you checked an activity (" . $activity . ") as completed, please list the number of minutes spent on the activity.");
    
    return false;
}

and an example of the callback rule is:
Code:
$this->form_validation->set_rules('rev_agenda_time', 'CheckActivities', 'callback_checkActivities[rev_agenda, rev_agenda_time]');

Any ideas why $activity won't print out in the message?

Thanks


Messages In This Thread
validation callback rules and dynamic text in the error mesage - by El Forum - 05-08-2009, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB