[QuickForm] group attributes

From: Date: Fri, 24 Oct 2003 16:58:24 +0000
Subject: [QuickForm] group attributes
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8564@lists.php.net to get a copy of this message
Hi! I have some elements in my form which should only be displayed to the user if he/she e.g. hits a specific radio-button in the first group. First I usually define the two groups via/in QF(C). Maybe this is useful for others, too : ------------- QuickForm --------------------- [..] $ele1[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes', '1', array('onClick' => 'toggleNode(\'rowNumber4\')') ); $ele1[] = &HTML_QuickForm::createElement('radio', null, null, 'No', '0', array('onClick' => 'toggleNode(\'rowNumber4\')') ); $this->addGroup($list1, 'element1', 'Do you want to display the next Question?'); // only display if former question has been confirmed with 'yes' $ele2[] = &HTML_QuickForm::createElement('radio', null, null, 'To hell', '0' ); $ele2[] = &HTML_QuickForm::createElement('radio', null, null, 'To heaven', '1'); $this->addGroup($ele2, 'element2', 'Here is the optional question: Where do you want to go tomorrow?'); [..] ------------- /QuickForm --------------------- ------------- JavaScript in dyn. (smart)Template --------------------- {literal} <script language="JavaScript" type="text/javascript"> <!-- function toggleNode(el) { document.getElementById(el).style.display = document.getElementById(el).style.display == 'none'? document.all?"block":"table-row":"none"; } //--> </script> {/literal} ------------- /JavaScript in dyn. (smarty)Template --------------------- I am in need to let my dynamic template know that a group defined in quickform has the attribute visibility=0 -> which meens it wont be shown by default. my feelings says that such infos should be some more in the view, but actually i dont really know how to implement this in the template-logic without the need to end up with dozens of slightly different templates. We could use the seperator-value, but personally I dont really want to use this member variable in the wrong context. Is there another way to get around this problem and to hand over some additional information on a quickform-group to the template? Furthermore I dont really like putting javascript-calls in the QuickForm code (in createElement), but I dont really know how else to do so. I am using QFC + ArraySmarty-renderer. Any ideas appriciated, because beside my problem it might be good to proof QuickForm is fexible enough to work with more complex forms ;o) Enjoy the w33k3nd.. --M

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