RE: [PEAR] Changing the way freeze() represents checkboxes and radio buttons
| From: | Justin Adie | Date: | Wed, 14 Jun 2006 11:33:11 +0000 |
| Subject: | RE: [PEAR] Changing the way freeze() represents checkboxes and radio buttons | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24354@lists.php.net to get a copy of this message | ||
The relevant code (for checkboxes) is in checkbox.php
[code]
function getFrozenHtml()
{
if ($this->getChecked()) {
return '<tt>[x]</tt>' .
$this->_getPersistantData();
} else {
return '<tt>[ ]</tt>';
}
}
[/code]
You can replace this as you like. Or write your own custom element class.
Note that quickform overrides any value that you might supply with a value
of 1 for checked so you cannot use a dynamic value here
The process is similar for advcheckboxes and radio boxes although the last
note above does not hold true.
Alternatively you could use tohtml() and then do a strreplace for
"<tt>[x]</tt>" and its unchecked variant. For radio buttons the square
brackets are replaced by round brackets.
-----Original Message-----
From: Noel da Costa [mailto:noel.dacosta@magharl.co.uk]
Sent: 13 June 2006 20:29
To: pear-general@lists.php.net
Subject: [PEAR] Changing the way freeze() represents checkboxes and radio
buttons
Hi,
I'm trying to use freeze() as an easy way of rendering to a table from form
data.
It all works OK, except that I can't find a way of changing the way
checkboxes and radio buttons are represented.
Ideally, I'd just like checkbox values to show as yes/no and radio buttons
simply to display the selected value (rather than both with x's).
Any ideas?
Thanks,
Noel da Costa
Lead Developer
noel.dacosta@magharl.co.uk
--
PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php