Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Unable to use NetefxValidatorRuleFUNCTION with MyLibrary


Reply


265 Views

Avatar
Sandhya

Community Member, 6 Posts

11 March 2013 at 6:35pm

Hello,

I have built a custom form.. When I tried to put validation I am not able to retain the posted values after the validation is fired. Various sites recommended the use of NetefxValidator module. However, I tried to create my own library for validation but NetefxValidatorRuleFUNCTION returns null. Please help.

Following is what i did in my code:

As per the documentation, I created a class file MyLibrary.php in mysite/code

$rule_startTime_Max = new NetefxValidatorRuleFUNCTION ("StartTime", "Start time cannot be greater than end time", 'error',array('MyLibrary', 'startTimeLessThanEndTime', array()))

class MyLibrary {

public static function startTimeLessThanEndTime($data, $args) {
         return true;
}

}

But the validation is fired every time. Also I tried print_r($data);exit(); but NetefxValidatorRuleFUNCTION .php

return call_user_func_array($function, $params);

always returns null...