Re: QF - how to do conditional validation of selects?

From: Date: Fri, 12 Dec 2003 19:24:02 +0000
Subject: Re: QF - how to do conditional validation of selects?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9487@lists.php.net to get a copy of this message
Bertrand - Using addFormRule() works well, however I'd like to be able to have these elements be part of a group since it gives me more control over the layout. When I do this, the validation function works, but the error message is never displayed. Code snippet for the group is below. I've tried adding <!-- BEGIN error -->{error}<!-- END error --> to the GroupElementTemplate, but it gets rendered as HTML -- {error} is displayed. Any suggestions? Thanks Graham $form->addGroup($row_2, 'row_2', '', '&nbsp;', false); $renderer->setGroupTemplate('<tr>{content}</tr>', 'row_2'); $renderer->setGroupElementTemplate('<td align="right" class="label">{label}<!-- BEGIN required --><font color="red">*</font><!-- END required -->&nbsp;</td><td align="left" class="content">{element}</td>', 'row_2'); At 01:24 AM 12/11/2003 +0100, Bertrand Mansion wrote:
<grahamc@53tech.com> wrote : Hi - I have a QF w/ two select elements, A & B. Users must always select an item from A, but are only required to select an item from B if the value of A is within a certain range (say A < 4 ). What's the best way to implement this in QF? I'd suggest the use of addFormRule(). See the documentation http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.add formrule.php There is another way that involves addRule(array(A, B), ...) and your own callback but it's more tricky and we haven't written the docs for that yet. Your case would make a good example... Feel free to investigate this too. Bertrand Mansion Mamasam -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Graham Clarke GrahamC@53Tech.com www.53Tech.com 603.643.9955

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