Re: QuickForm problem

From: Date: Fri, 02 Jan 2004 16:02:46 +0000
Subject: Re: QuickForm problem
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9911@lists.php.net to get a copy of this message
Alle 13:58, venerdì 2 gennaio 2004, Bertrand Mansion ha scritto: > Why don't you use setDefaults() to set your hidden field value too. > Or even better, setConstants() as these values are probably not > modifiable (unless you use them in a javascript). This script is used to change the values of a form submitted previously. I get the old values from the db, then I use setDefaults() to fill in the form. The hidden value is used just as a marker to tell the script to update the values in the db. > I think there must be a problem somewhere else in your script where > you set the hidden field value to an empty value. But I can only > guess... It shouldn't be so, here's the snippet: 1 if (!$form->validate()) { 2 $form->setDefaults($tblSegn->recdData); 3 $azione =& $form->addElement('hidden', 'azione', 'Modifica'); 4 $azione->setValue('Modifica'); 5 $form->addElement('hidden', 'id', $_REQUEST['id']); 6 $form->addElement('button', 'indietro', 'Indietro', 'onclick="javascript:history.back()"'); 7 $tpl =& new HTML_Template_ITX('./tpl'); 8 $tpl->loadTemplateFile('form_adm.html', TRUE, FALSE); 9 $renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl); 10 $renderer->setRequiredTemplate('<span class="required">** </ span>{label}'); 11 $renderer->setErrorTemplate('<span class="error">{error}</ span><br>{label}'); 12 $form->accept($renderer); 13 $tpl->show(); } This works. If I change lines 3 and 4 to $form->addElement('hidden', 'azione', 'Modifica'); I find an empty hidden field in the form (value=""). There are no setElement() method calls, nor any other reference to 'azione'. Thanks for the hints, though :) Ciao ce -- Cesare D'Amico - boss (@t) cesaredamico (dot) com http://www.cesaredamico.com To err is human, to forgive is not our policy.

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