[Flow] How to build a search/filter form above of a list

Bastian Waidelich bastian at typo3.org
Fri Nov 1 15:17:33 CET 2013


Axel Wüstemann wrote:

>> If the form is used only to filter a result (and has no side-effects on
>> the server) you probably want to use "GET" as method.
>
> ... with up to 5 additional arguments in the url and the indexAction -
> letter would not nice ti read and to change.

...but bookmarkable, sharable and cacheable!


>>> public function indexAction(array $filter = null) {
>>
>> This should work, but you should try to avoid array as a placeholder for
>> objects. Instead you can create a simple filter "Data Transfer Object":
>
> I tried to avoid this, because I have five types of this filter forms. I
> appreciate Flow of being very clear and elegant, but such a Data
> Transfer Object in this case seemed to me to much efford for the related
> purpose, or?

Well it's always a matter of weighting. If your DTO only contains 
setters & getters there is not much gain from it apart from being 
self-explanatory and more explicit (which you shouldn't underestimate).
But the real strength of objects is that they can contain logic and 
constraints: E.g. the property "date" in your filter would be mapped to 
a DateTime object rather than the date-string it gets from the submitted 
form and you could verify whether that date is in an allowed ranged and 
and...



>> It should be something like:
>>
>>
>> <f:form.select property="fast" options="{fasts}" />
>>
>> <f:form.textfield property="slow" />
>>
> Yes ist is:
> http://pastebin.com/yXA4WAGT

Compare the two once again.
And then replace all "<input>" tags by "<f:form.textfield>" ;)


-- 
Bastian Waidelich
--
Core Developer Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the Flow mailing list