From: Andrey Kutejko Date: Tue, 25 Jun 2013 20:53:25 +0000 (+0300) Subject: value of bound field X-Git-Tag: 0.5~204 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=7973e7e4c82108a3f23f461502b0843e41f520d3;p=ipf.git value of bound field --- diff --git a/ipf/form/boundfield.php b/ipf/form/boundfield.php index 22416d8..5794474 100644 --- a/ipf/form/boundfield.php +++ b/ipf/form/boundfield.php @@ -27,6 +27,14 @@ class IPF_Form_BoundField } } + public function value() + { + if ($this->form->is_bound) + return $this->field->widget->valueToFormData($this->html_name, $this->form->data); + else + return $this->form->initial($this->name); + } + public function render_w($widget=null, $attrs=array()) { if ($widget === null) { @@ -37,12 +45,7 @@ class IPF_Form_BoundField and !array_key_exists('id', $widget->attrs)) { $attrs['id'] = $id; } - if (!$this->form->is_bound) { - $data = $this->form->initial($this->name); - } else { - $data = $this->field->widget->valueToFormData($this->html_name, $this->form->data); - } - return $widget->render($this->html_name, $data, $attrs); + return $widget->render($this->html_name, $this->value(), $attrs); } public function labelTag($contents=null, $attrs=array())