Issus while updating from QF to QF2
| From: | Olaf Gleba | Date: | Sun, 12 Feb 2012 21:25:57 +0000 |
| Subject: | Issus while updating from QF to QF2 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-31406@lists.php.net to get a copy of this message | ||
Hi,
i am currently updating my CMS form processing from QuickForm to QuickForm2.
I got used to the new concept and vary syntax except two issues.
1. Adding/use rules with callbacks
Searching for former posts on the list i found http://news.php.net/php.pear.general/31351
which seems to be similiar to my problem/question.
I have a login page with a username and password form fields. While submitting the form i must
supply both field values to a indepent class method. The method checks the database if the given
combination fits. Returns false/true. On PasteBin there is a abstract of the current implementation
[1].
Are there any example how to this within QuickForm2? Subclassing the factory Rule file is fine, but
my knowledge is simply not well enough to do it without any docs or examples ;-)
2. The cms uses smarty. To leave the (smarty)templates as clean and small as possible, i currently
inject a little helper template right before rendering the form to avoid putting the same
declaration of <required> and/or <error> vars (and conditions) over and over on every
form field within the smarty templates. This little template snippet [2] relies on the former func
setRequiredTemplate(). Is there any complement for this function in QF2?
[1] http://pastebin.com/Np2BwFFi
[2] http://pastebin.com/7Xmfj3Xr
I am very grateful for some help on both topics!
greets
Olaf