Ravani Posted January 24, 2011 Share Posted January 24, 2011 Hi, I was wondering if anyone here has experience with the best way to preview a form? I want two buttons on the bottom of my form: submit and preview. When a visitor clicks on preview he will be given a preview of the submitted values where he can go back to make changes or click on submit to commit the values. Anyone has an idea to do this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/ Share on other sites More sharing options...
ignace Posted January 24, 2011 Share Posted January 24, 2011 class SavePreviewForm extends Zend_Form { public function isPreviewClicked() { return $this->getElement(self::PREVIEW)->isChecked(); } public function isSaveClicked() { return $this->getElement(self::SAVE)->isChecked(); } } Quote Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/#findComment-1164558 Share on other sites More sharing options...
Ravani Posted January 25, 2011 Author Share Posted January 25, 2011 Thanks, do you have a simple example of that? Quote Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/#findComment-1164903 Share on other sites More sharing options...
ignace Posted January 25, 2011 Share Posted January 25, 2011 $form = new SavePreviewForm(); if($this->getRequest()->isPost()) { if($form->isValid($this->getRequest()->getPost()) { if($form->isPreviewClicked()) { /* code to handle preview */ } if($form->isSaveClicked()) { /* code to handle save */ } } } Quote Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/#findComment-1164951 Share on other sites More sharing options...
Ravani Posted January 26, 2011 Author Share Posted January 26, 2011 Thanks, works good ! Quote Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/#findComment-1165444 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.