Re: Issus while updating from QF to QF2

From: Date: Mon, 20 Feb 2012 18:21:29 +0000
Subject: Re: Issus while updating from QF to QF2
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-31424@lists.php.net to get a copy of this message
Hi Alexey, sorry for the delay. First, thank you for answering. Am 14.02.2012 um 14:52 schrieb Alexey Borzov: > I don't see any problems with directly porting your code. In fact, I was wrong in the > linked answer when I said that it's impossible to access value of another element, as I missed > an option of passing the element / its value as an additional argument to the callback. > > $email = $form->addElement(...); > $password = $form->addElement(...); > > $password->addRule( > 'callback', gettext('Invalid password'), > array( > 'callback' => array($LOGIN, 'testSecret'), > 'arguments' => array($email->getValue()) > ) > ); That's fine. Brilliant. I played around with somehow likely these days, but missed the right solution obviously. Thanks a lot for the example. >> [...] This little template snippet [2] relies on the former func setRequiredTemplate(). Is >> there any complement for this function in QF2? > > No, there's nothing similar it seems. Even port of ArraySmarty renderer [1] does not > contain this method. Note, however: it was implemented in such a way that the template was re-parsed > on outputting every required element, leading to major performance hit. > > Smarty now has macros (or template functions) it seems [2] and that's how I'd suggest > to re-implement that. > > [1] http://pear.php.net/pepr/pepr-proposal-show.php?id=653 > [2] > http://www.smarty.net/docs/en/language.function.function.tpl Thank for that also. I'll have a look what compares best with the former setRequiredTemplate() method. Cheers Olaf

« previous php.pear.general (#31424) next »