quickform : how to modify values before process
| From: | Julien Tschäppät | Date: | Sat, 31 Dec 2005 00:15:57 +0000 |
| Subject: | quickform : how to modify values before process | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22395@lists.php.net to get a copy of this message | ||
Hi,
I have made an order form.
Each item is composed of two fields. In the first the customer give
the number of items he want. The second field show the price of the
item(s). Its value is calculate in a javascript function.
When the customer submit the form I call the freeze() function to show
a recapitulation of the order and the customer have to click a second
time on the submit button to confirm his order.
My problem : if javascript is disable the price is not calculate
(logical :-) ). What can I do to update the fields before the freeze ?
my script :
// ...
//first item
$item1[] = &HTML_QuickForm::createElement('text', 'quantityItem1',
'Item 1 : ', 'onkeyup="updateValues()"');
$item1[] = &HTML_QuickForm::createElement('text', 'totalPriceItem1',
null, 'readonly="readonly"');
$form->addGroup($item1, 'item1Group');
//other items
// ...
//some elements
$form->addElement(/*...*/);
//some validation rules
$form->addRule(/*...*/);
//process
if($form->validate())
{
if(isset($form->_submitValues['confirmTest']))
{
$form->process('processFunction');
}
else
{
$form->addElement('hidden', 'confirmTest', 'ok');
$form->freeze();
}
}
// ...
Thank you for your help
Julien