PHP | Problem - Netefx rule.
/**
* Making it monkey-proof. Polls can never overlap!
* It's kinda bugging out :( Something with the javascript handler.
* @return NetefxValidator
*/
public function getCMSValidator(){
$function = create_function('$data,$args', '
$extraAnd = "";
if(isset($data["ID"])){
$extraAnd = " AND ID != ".$data["ID"];
}
if($data["IsDefault"] == 1){
if($exists = DataObject::get("Poll", "Lang = \'".$data[\'Lang\']."\' AND IsDefault = 1 AND ClientID = \'".$args["ClientID"] . $extraAnd . "\'")){
return false;
}
}
return true;'
);
$return = new NetefxValidatorRuleFUNCTION('IsDefault', _t($this->class . '.UNIQUEFIELD','this field must be unique'), null, $function);
return $return;
}
/**/
25/01/2012 6:05pm
PHP | Solution - Zauberfisch
$rule = new NetefxValidatorRuleFUNCTION('IsDefault', _t($this->class . '.UNIQUEFIELD','this field must be unique'), null, $function);
return new NetefxValidator($rule);25/01/2012 5:37pm
Template | Problem - Simon
The error
ERROR [User Error]: Uncaught Exception: Object->__call(): the method 'setjavascriptvalidationhandler' does not exist on 'NetefxValidatorRuleFUNCTION'
IN POST /admin/facebook/Poll/CreateForm
Line 724 in /var/www/vhosts/facebook-app/http-docs/sapphire/core/Object.php
Source
======
715:
716: default :
717: throw new Exception (
718: "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config,
true)
719: );
720: }
721: } else {
722: // Please do not change the exception code number below.
723:
* 724: throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'",
2175);
725: }
726: }
727:
728: //
-----------------------------------------------------------------------------------------------------------------
729:
730: /**
Trace
=====
you are returning a rule, when you should return a validator