logo       

QFC/smarty renderer - visibility: msg#00415

php.pear.general

Subject: QFC/smarty renderer - visibility

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
, because how should the template know about it?

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.

bye
--M

--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise