FormBuilder and update with frozen fields
| From: | Alessandro Pasotti | Date: | Wed, 12 Oct 2005 13:50:06 +0000 |
| Subject: | FormBuilder and update with frozen fields | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21393@lists.php.net to get a copy of this message | ||
Hello,
I saw a similar post with frozen dates, but cannot solve my problem,
It seems that frozen fields (excluded from userEditableFields) are rendered as
HIDDEN values, these are hence passed to the form.
Maybe I'm wrong, but basically my script does this:
-------
$do = SIGDB_DataObject::factory($table);
$do->get($id);
$fb = SIGFormBuilder::create($do);
$form = $fb->getForm("./?module=$module");
if($form->validate()) {
$db->autoCommit(false);
$result = $form->process(array(&$fb,'processForm'), false);
if($result === true) {
$db->commit();
return 'ok';
} else {
// print some error stuff
}
}
print $form->toHtml();
-------
What happens on update?
$do->get($id) repopulate the form with old values, and formbuilder overwrite
only userEditableFields, this is ok, but when processForm calls
$this->_do->update() DO has all values set (old and new) together, the
resulting query updates all fields, frozen or not.
This is not the expected behaviour, I wish a query to update only fields that
are not frozen.
Am I doing something wrong?
--
Alessandro Pasotti
ICQ# 245871392
Linux User #167502