diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 728846716e40e49336f8f33f6e4b2b616ffe033e..174066f8136abd9abf7827f55a69a02afa91396c 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -121,8 +121,9 @@ class DynamicForm extends VerySimpleModel { $fields = $this->getFields(); $form = new SimpleForm($fields, $source, array( 'title' => $this->getLocal('title'), - 'instructions' => $this->getLocal('instructions')) - ); + 'instructions' => $this->getLocal('instructions'), + 'id' => $this->getId(), + )); return $form; } @@ -947,6 +948,9 @@ class DynamicFormEntry extends VerySimpleModel { function getId() { return $this->get('id'); } + function getFormId() { + return $this->form_id; + } function getAnswers() { return $this->answers; @@ -998,7 +1002,8 @@ class DynamicFormEntry extends VerySimpleModel { $source = $source ?: $this->getSource(); $options += array( 'title' => $this->getTitle(), - 'instructions' => $this->getInstructions() + 'instructions' => $this->getInstructions(), + 'id' => $this->form_id, ); $this->_form = new CustomForm($fields, $source, $options); } diff --git a/include/class.forms.php b/include/class.forms.php index 34c162a14c33945f94598b75afdb57ddd31a5bdd..0543023932da1a8dd0f4870cb7ed3d583a0de417 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -46,7 +46,7 @@ class Form { $this->_source = ($source) ? $source : $_POST; } - function getId() { + function getFormId() { return @$this->id ?: static::$id; } function setId($id) { @@ -1096,7 +1096,7 @@ class FormField { */ function getFormName() { $default = $this->get('name') ?: $this->get('id'); - if ($this->_form && is_numeric($fid = $this->_form->getId())) + if ($this->_form && is_numeric($fid = $this->_form->getFormId())) return substr(md5( session_id() . '-form-field-id-' . $fid . $default), -14); elseif (is_numeric($this->get('id')))