Fw: QuickForm: exportChangedValues / getDefault
| From: | Aidan Lister | Date: | Tue, 23 Dec 2003 04:34:04 +0000 |
| Subject: | Fw: QuickForm: exportChangedValues / getDefault | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9792@lists.php.net to get a copy of this message | ||
Hello,
I'd like to propose a quickform function.
This function would return only 'changed' values of a form. Perhaps
QuckForm::exportChangedValues.
The way this function would work would be as follows:
1) Form is created
2) Default values are set
3) Form is filled with data new data
4) exportChangedValues is called
exportChangedValues would then check the default value of each element, if
the submitted safe value does not match - then it would return that value.
This could be coded externally, however you would require a method
QuickForm::getDefault (as opposed to setDefault).
A quick knock-up function is below:
function exportChangedValues () {
foreach ($form->_defaultValues as $key => $value) {
if ($form->exportValue($key) != $value) {
$arr[] = $form->exportValue($key);
}
}
return $arr;
}
Thanks for listening.