21289 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 544 Views |
-
onBeforeWrite + remove fields before saving

6 May 2011 at 12:49am Last edited: 6 May 2011 12:49am
hi
I want to remove some fields from saving if some conditions match ... example:
public function onBeforeWrite() {
if($this->owner->salutation == 'Ms') {
unset ($this->owner->somefield);
}parent::onBeforeWrite();
}If users salutation = "Ms" the field "somefield" should be ignored when saving, even user changed the field ...
The sample code dont work for me.
thx
-
Re: onBeforeWrite + remove fields before saving

6 May 2011 at 6:23am
I haven't tested this in a decorator, only in a Page class, where replacing $this->somefield with $this->record['somefield'] did the trick. So maybe unset($this->owner->record['somefield']); will work...
-
Re: onBeforeWrite + remove fields before saving

7 May 2011 at 3:05am
hi
no, did not the trick in a decorator, still searching for a solution ...
thx
| 544 Views | ||
|
Page:
1
|
Go to Top |

