mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
a181f7c151
commit
f4dd20b979
@ -31,14 +31,11 @@ class CustomRequiredFields extends RequiredFields{
|
||||
if(is_array($this->required)){
|
||||
|
||||
foreach($this->required as $field) {
|
||||
if($fields->dataFieldByName($field)) {
|
||||
if(is_array($field) && $field['js']){
|
||||
$code .= $field['js'] . "\n";
|
||||
|
||||
}else{
|
||||
$code .= " require('$field');\n";
|
||||
//Tabs for output tabbing :-)
|
||||
}
|
||||
if(is_array($field) && $field['js']){
|
||||
$code .= $field['js'] . "\n";
|
||||
}else if($fields->dataFieldByName($field)) {
|
||||
$code .= " require('$field');\n";
|
||||
//Tabs for output tabbing :-)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -59,15 +56,13 @@ class CustomRequiredFields extends RequiredFields{
|
||||
}
|
||||
if($this->required){
|
||||
foreach($this->required as $key => $field) {
|
||||
if($fields->dataFieldByName($field)) {
|
||||
if(is_array($field) && $field['php']){
|
||||
eval($field['php']);
|
||||
}else{
|
||||
// if an error is found, the form is returned.
|
||||
if(!$data[$field]) {
|
||||
$this->validationError($field,"$field is required","required");
|
||||
return false;
|
||||
}
|
||||
if(is_array($field) && $field['php']){
|
||||
eval($field['php']);
|
||||
}else if($fields->dataFieldByName($field)) {
|
||||
// if an error is found, the form is returned.
|
||||
if(!$data[$field]) {
|
||||
$this->validationError($field,"$field is required","required");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user