[TYPO3-dev] Extbase: Setting relational field to empty using frontend´

Henjo Hoeksma | Stylence me at henjohoeksma.nl
Sat Feb 16 11:21:13 CET 2013


Like I said in my response to Stefano, it would be better to check in your
setter method of your model to check wether something is NULL or not.
If it is some fancy checking you need to do, you could write a Domain
Utility of Custom Domain Object Validator to do so.

Take a look at the validator classes to see what it possible there.

When putting this stuff in your controller you are placing domain logic in
your application, instead of keeping it in the domain.
Doing this you will find yourself repeating code to achieve the same things
over and over and you are on a fast track of getting into trouble ;-)

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Fri, Feb 15, 2013 at 7:19 PM, Stefano Cecere <scecere at krur.com> wrote:

> Hi Anders
>
> i have the same problem
> i explained it (with a solution i found) here
> http://forum.typo3.org/index.**php/t/194225/<http://forum.typo3.org/index.php/t/194225/>
>
> note : the typo3v4mvc newsgroup is the right place for Extbase/Fluid topics
>
> ciao
>
>
>
> On 14/02/13 14:07, Anders Gissel wrote:
>
>> Hey y'all,
>>
>> I'm building an Extbase-extension (6.0.1), and my model has a field that
>> relates to another table using a simple dropdown. The user can then
>> select a single value, and all is fine.
>>
>> However: once the user has selected (and saved) a value, he can't empty
>> the field again... I've added an empty value to both the frontend
>> selector and the TCA, but apparently setting an empty value is the same
>> as selecting nothing at all. Therefore, the only way to empty the field
>> is to do it through the backend. Selecting a different value works just
>> fine, but obviously that's not what I'm after.
>>
>> My question then is: how do I empty the field from the frontend? Once
>> the data reaches the controller's updateAction() it has already been
>> processed, so how do I go about it? Can anyone recommend any material on
>> the subject?
>>
>>
>> Best regards,
>> Anders
>>
>
>
> --
>
> -- --- ----- -------
>
> Stefano Cecere
> KRUR studio - http://krur.com
>
> ______________________________**_________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>
>



More information about the TYPO3-dev mailing list