Saving bug fixing with when value equals undefined

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43536 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Romain Louis 2007-10-17 22:48:17 +00:00
parent 81d774fcf7
commit cf7adf02da

View File

@ -85,12 +85,13 @@ class HasOneComplexTableField extends ComplexTableField {
function saveInto( DataObject $record ) {
$fieldName = $this->name;
$fieldNameID = $fieldName . 'ID';
if( $val = $this->value[ $this->htmlListField ] )
$record->$fieldNameID = $val;
else
$record->$fieldNameID = 0;
$record->$fieldNameID = 0;
if( $val = $this->value[ $this->htmlListField ] ) {
if( $val != 'undefined' )
$record->$fieldNameID = $val;
}
$record->write();
}