QuickForm_submit: problem with changeable value
| From: | Thomas Schulz | Date: | Mon, 24 Feb 2003 18:07:52 +0000 |
| Subject: | QuickForm_submit: problem with changeable value | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-13783@lists.php.net to get a copy of this message | ||
Hi,
after I define my form and get it via $frm->toArray I use Smarty to
render the HTML. In smarty I have an modifier doing some i18n:
<td>{$element.label|translate}</td><td>{$element.html}</td>
(Submit)buttons must handled in a special case because her value is the
"label":
<td><input type="{$element.type}" name="{$name}"
value="{$element.value|translate}"></td>
But in this way on every submit the value (code for i18n) is changed
because it is not constant (so also the user can change the value by
manipulate the HTML-Code).
My frist workaround was define elementname as "null":
$frm->addElement('submit', null, 'B_save');
This works fine. But I can't make an removeElement() on the button
especially before freeze() the form. So I have to set the button value
manually as constant:
$constantValues['submit_contact'] = 'B_save';
$frm->setconstants($constantValues);
$frm->addElement('submit', 'submit_contact');
How about to make the value of an submit button constant by default?
Thomas.
--
http://4bconsult.de