From 9b9324b1200f5a62ddf877082a2d2aff257385e1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 18 Mar 2013 12:57:39 +0100 Subject: [PATCH] LSform // dataEntryForm : set default value of displayed elements --- public_html/includes/class/class.LSform.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public_html/includes/class/class.LSform.php b/public_html/includes/class/class.LSform.php index 8462a648..3f7ea0eb 100644 --- a/public_html/includes/class/class.LSform.php +++ b/public_html/includes/class/class.LSform.php @@ -652,6 +652,17 @@ class LSform { } $this -> dataEntryForm = $dataEntryForm; $this -> dataEntryFormConfig = $config; + + // Set default value of displayed elements + if(is_array($config['defaultValues'])) { + foreach($config['displayedElements'] as $el) { + if (isset($config['defaultValues'][$el])) { + if (isset($this -> elements[$el])) { + $this -> elements[$el] -> setValueFromPostData($config['defaultValues'][$el]); + } + } + } + } return true; } LSerror :: addErrorCode('LSform_07',$dataEntryForm);