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! 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(); } } 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? 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 */ } } } 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 ! Link to comment https://forums.phpfreaks.com/topic/225502-zend_form-preview-form/#findComment-1165444 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.