2008年10月14日星期二

[fw-mvc] Zend Form Improvement

Hello everyone,

 

Today while working with Zend Form while using it to edit a form I wanted to have an easy way to check to see if anything changed and then return any fields that have changed.  The way I figured this would work is like this in your controller

 

$defaultValues = array(<some values here>);

$form = new My_Form();

If($form->isValid($_POST)) {

    $changedValues = $form->getChangedValues($defaultvalues);

}

 

That way you could only process any values that changed or skip the processing if nothing changed.

 

http://www.whitcraftconsulting.com/images/php5_zce_logo_new.gif

Jon Whitcraft
Indianapolis Motor Speedway
jwhitcraft@brickyard.com

P: (317) 492-8623 - F: (317) 492-6419


 


********************
********************
This E-mail (and attachments) may contain confidential/privileged information intended only for the named addressee(s). If you are not an intended recipient, do not read, copy, disseminate or take any action based on the content of this E-mail. Please notify the sender by reply E-mail and erase this E-mail from your system. Your assistance is appreciated. E-mail transmission may not be secure or error-free. The company is not responsible for any loss/damage arising from any virus transmitted.
********************
********************

没有评论: