Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » RADICORE Suggestions » Validation plug-ins
Re: Validation plug-ins [message #267 is a reply to message #264] Thu, 07 September 2006 10:49 Go to previous messageGo to previous message
janalwin is currently offline  janalwin
Messages: 17
Registered: May 2006
Location: Groningen
Junior Member
Just been thinking it over.

If you call a method in a custom validator class by the name defined in the data dictonary, it will be hard to exchange the validator-methods with others, or to put it in other projects without altering working code.

Wouldn't it be a better idea to load a class with a standard interface from a directory with validators.

For example
=== Valdidator class ====

class dutch_postcode {
var $errors=Array();

function validate($fieldname) {
//.. put custom validation code here
}

function getErrors() {
return $errors
}
}


==== validator call code ====

if (isset($fieldspec[$fieldname]['custom_validator'])) {



require_once($path_to_validators . $fieldspec[$fieldname]['custom_validator']) . ".class.inc");

$validator =& singleton::getInstance($fieldspec[$fieldname]['custom_valida tor']);

$validator->validate();

$this->errors=array_merge($this->errors,$validator->getErrors())

} // end if










 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: component scripts
Next Topic: Quick Start Guide
Goto Forum:
  


Current Time: Wed Jun 26 06:19:13 EDT 2024

Total time taken to generate the page: 0.01229 seconds