2008年8月15日星期五

[fw-mvc] Zend_Form 1.6RC2 - Populate form problem

Hi all,

I'm certain this is probably a user error rather than a bug but using ZF 1.6 RC2 and Zend_Form creates a small problem for me.

I've a form with multiple subforms, each subform has buttons attached. To check if a reset button has been pushed (just a standard Submit element) I was doing:

$form->populate($data); -- Where $data was the result of a POST.

$form->reset->isChecked() - where 'reset' is the name of the element.

On moving to 1.6 the POST data format changed, moving the button values into the subform in array notation, as follows:
Array
(
[confirm] => Array
(
[email] => blah@blah.net
[dateform] => Array
(
[day] => 18
[month] => 7
[year] => 2008
)

[price] => zz
[reset] => Reset
)
)
I actually thought this was more logical and probably a bug fix, so attempted to check if the button was checked with $form->confirm->reset->isChecked() - however this leads to a fatal error calling a function on a non-object.

Any thoughts?

Cheers,

Steve

没有评论: