[TYPO3-mvc] Model property doesn't get updated, if all multi select values are deselected

Tobias Pinnekamp typo3 at tpinne.de
Wed Jan 18 14:02:36 CET 2012


Hi everyone,

I'm stuck with this problem for a while now and I don't find any 
solution on the web.

I have a model with a property which is a m:n relation to another. So it 
is an ObjectStorage. I use a form.select with the multiple settings to 
handle this. Selecting the values and storing them works fine. Even 
changing them.
But when I deselect all entries this property doesn't get updated and 
shows the values from before.

<f:form.select property="branches" multiple="multiple" 
options="{branches}" optionLabelField="name" optionValueField="uid" 
value="{user.branches}" />

This renders the select box properly even with a hidden field as 
fallback known from the checkbox view helper.

If I debug the incoming object in my controller the object storage is empty.

public function updateAction(Tx_RvIntranet_Domain_Model_User $user) {
	// $user->getBranches() show an empty object storage
	var_dump($user);
	
	$this->userService->getRepository()->update($user);
	$this->redirect('index');
}

The interesting part is, that every other option I modify - even other 
m:n relations - are updated properly, as long I have one option selected 
for the m:n relations.

Anyone an idea?

Best regards
Tobias


More information about the TYPO3-project-typo3v4mvc mailing list