axiom82
axiom82

Reputation: 632

How do I stop Zend_Form::isValid from removing the values of submit buttons?

I have a Zend_Form object that generates a form in my view.

It does POST processing and submits data to my database.

Sometimes, I notice that my submit button, which simply says "Update Your Changes" is stripped of its value, so its just a button with no text value. I'm surprised Zend_Form is not coded to ignore clearing values from submit buttons.

Is there a way to stop this from happening?

Upvotes: 0

Views: 49

Answers (2)

Wolfish
Wolfish

Reputation: 970

In addition to s-rupali's answer, you might also try isValidPartial(). This method, regardless of how you implement it (I'm a c# kinda guy) will not validate disabled elements You can then temporarily set your button to disabled, whilst the submission occurs. Afterwards, you can create another method to re-enable it.

http://framework.zend.com/manual/en/zend.form.quickstart.html#zend.form.quickstart.validate

Upvotes: 0

Rupali
Rupali

Reputation: 1078

You can try setting the value forcefully in the decorator:

<?php echo $this->element->update_btn->setLabel('Update Your Changes');?>

Upvotes: 1

Related Questions