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

Stefano Cecere scecere at krur.com
Thu Sep 6 16:44:18 CEST 2012


Hi Tobias
did you ever find any solution to this problem?



On 18/01/12 14:02, Tobias Pinnekamp wrote:
> 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


-- 

-- --- ----- -------

Stefano Cecere
KRUR studio - http://krur.com


More information about the TYPO3-project-typo3v4mvc mailing list