Implement server side required check on custom fields

This commit is contained in:
Nathan Gray 2013-06-25 20:49:13 +00:00
parent 059e82a01b
commit ac45bd0625

View File

@ -267,11 +267,14 @@ class etemplate_widget_customfields extends etemplate_widget_transformer
if (!$this->is_readonly($cname, $form_name)) if (!$this->is_readonly($cname, $form_name))
{ {
$value_in = self::get_array($content, $form_name); $value_in = self::get_array($content, $form_name);
$app =& $this->getElementAttribute(self::GLOBAL_VALS, 'app');
$customfields =& $this->getElementAttribute(self::GLOBAL_VALS, 'customfields');
if(is_array($value_in)) if(is_array($value_in))
{ {
foreach($value_in as $field => $value) foreach($value_in as $field => $value)
{ {
if ((string)$value === '' && $this->attrs['needed']) $field_settings = $customfields[substr($field,1)];
if ((string)$value === '' && $field_settings['needed'])
{ {
self::set_validation_error($form_name,lang('Field must not be empty !!!'),''); self::set_validation_error($form_name,lang('Field must not be empty !!!'),'');
} }