Fixed CustomRequiredFields (merged from 2.1.0-textme branch, r42959)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43116 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-04 21:58:10 +00:00
parent a181f7c151
commit f4dd20b979

View File

@ -31,14 +31,11 @@ class CustomRequiredFields extends RequiredFields{
if(is_array($this->required)){ if(is_array($this->required)){
foreach($this->required as $field) { foreach($this->required as $field) {
if($fields->dataFieldByName($field)) { if(is_array($field) && $field['js']){
if(is_array($field) && $field['js']){ $code .= $field['js'] . "\n";
$code .= $field['js'] . "\n"; }else if($fields->dataFieldByName($field)) {
$code .= " require('$field');\n";
}else{ //Tabs for output tabbing :-)
$code .= " require('$field');\n";
//Tabs for output tabbing :-)
}
} }
} }
}else{ }else{
@ -59,15 +56,13 @@ class CustomRequiredFields extends RequiredFields{
} }
if($this->required){ if($this->required){
foreach($this->required as $key => $field) { foreach($this->required as $key => $field) {
if($fields->dataFieldByName($field)) { if(is_array($field) && $field['php']){
if(is_array($field) && $field['php']){ eval($field['php']);
eval($field['php']); }else if($fields->dataFieldByName($field)) {
}else{ // if an error is found, the form is returned.
// if an error is found, the form is returned. if(!$data[$field]) {
if(!$data[$field]) { $this->validationError($field,"$field is required","required");
$this->validationError($field,"$field is required","required"); return false;
return false;
}
} }
} }
} }