parents-merge 40044 - add resetData() function so that the payment can be reset and used the 'real' data after a order form submitted.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45059 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-11-19 02:02:25 +00:00
parent 4a65391d09
commit 528fb572fe

View File

@ -561,6 +561,17 @@ class Form extends ViewableData {
return $data;
}
function resetData($fieldName, $fieldValue){
$dataFields = $this->fields->dataFields();
if($dataFields){
foreach($dataFields as $field) {
if($field->Name()==$fieldName) {
$field = $field->setValue($fieldValue);
}
}
}
}
/**
* Call the given method on the given field.
* This is used by Ajax-savvy form fields. By putting '&action=callfieldmethod' to the end