LSform :: dataEntryForm : Added requiredAttributes parameter
authorBenjamin Renard <brenard@easter-eggs.com>
Mon, 29 Nov 2010 11:05:20 +0000 (12:05 +0100)
committerBenjamin Renard <brenard@easter-eggs.com>
Mon, 29 Nov 2010 11:05:20 +0000 (12:05 +0100)
public_html/includes/class/class.LSform.php

index 4e46920..414882f 100644 (file)
@@ -140,6 +140,9 @@ class LSform {
           continue;
         }
         $element = $this -> elements[$elementName];
+        if (isset($this -> dataEntryFormConfig['requiredAttributes']) && is_array($this -> dataEntryFormConfig['requiredAttributes']) && in_array($elementName,$this -> dataEntryFormConfig['requiredAttributes'])) {
+            $element -> setRequired();
+        }
         $field = array();
         $field = $element -> getDisplay();
         if (isset($this -> _elementsErrors[$element -> name])) {
@@ -432,6 +435,9 @@ class LSform {
           continue;
         }
         $element = $this -> elements[$elementName];
+        if (isset($this -> dataEntryFormConfig['requiredAttributes']) && is_array($this -> dataEntryFormConfig['requiredAttributes']) && in_array($elementName,$this -> dataEntryFormConfig['requiredAttributes'])) {
+            $element -> setRequired();
+        }
         if( !($element -> getPostData($this -> _postData)) ) {
           LSerror :: addErrorCode('LSform_02',$element_name);
           return;