Re: HTML_QuickForm usage advise wanted
| From: | Justin Patrin | Date: | Mon, 07 Jun 2004 19:09:36 +0000 |
| Subject: | Re: HTML_QuickForm usage advise wanted | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12978@lists.php.net to get a copy of this message | ||
Ian P. Christian wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've been using HTML_QuickForm for a while, and I often find myself wanting to do the same thing with it, and have yet to come up with a solution that I'm 100% satisfied with, so I thought I would ask here to see if anyone has a clean solution. I use HTML_QuickForm with DB_DataObject, and I often want to use the same form I use for creating an entry, to be used for viewing and editing. All of the forms I construct as done so in the constructor of a class I extend from HTML_QuickForm. The problem is, when viewing a record, the main form heading needs changing to 'Viewing ....', when editing, it's 'Editing....' and when creating, it's 'Creating....'. Other changes involve setting up the submit buttons, for example, when the form is in 'view' mode, a 'delete' and 'edit' button might want to be added to the form. As the form is generated in the constructor, the only way of achiving this would be to add a setMode() function to my forms, where you can change the mode of a form, but then the class would need to go back and remove/edit elements that has already been added to the form. The other alternative was to pass the mode, and the default data in the constructor to the form. Does anyone have any suggestions, or a better way of doing this? Kind Regards, - -- Ian P. Christian - pookey@pookey.co.uk - http://www.pookey.co.uk/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAwgdHEe6ncNCcEO0RAszzAJ9ECl6ElHkRK7fMiYIFjMOS6ld77QCgyIEg Oly2IsYtDZiZSUUXtb0ZB1k= =Zl5v -----END PGP SIGNATURE-----I don't really have an answer to your question, but I wanted to point out that DB_DataObject_FormBuilder can do the form building and such for you and also do links and lots of other useful things. -- paperCrane <Justin Patrin>