[TYPO3-mvc] HMAC check fails / form view helper
Claus Due
claus at wildside.dk
Mon Sep 26 00:49:45 CEST 2011
Hi Till,
On Sep 26, 2011, at 12:28 AM, g4-lisz at tonarchiv.ch wrote:
> Hi,
>
> I already wrote to this list concerning this issue, but i got now answer.
That happens sometimes, I apologize for that.
> This time i try to describe the solution i'm looking for more precisely.
>
> Normally the form view helper can be used in a search form like this (e.g. with select input type):
>
> <f:form name="demand" object="{demand}" action="results">
> <f:form.select property="city" options="{cities}" optionLabelField="name" />
> <f:form.submit value="Search" />
> </f:form>
>
> (Class "demand" has a property "city"; A list of all cities is attached to the view as "cities".)
>
> I don't like the drop-down (select) input type for my purpose. A list (ul) with all city's names as links to click on would be more straight forward.
>
> Is there a way to get this working?
Absolutely. HMAC safe too. I suggest using DHTML:
<f:form.hidden property="city" id="someid" />
<ul>
<f:for each="{cities}" as="city">
<li><a data-value="{city.id}" href="javascript:;" onclick="jQuery('#someid').val(jQuery(this).attr('data-value');">{city.name}</a></li>
</f:for>
</ul>
...but you may want to use another way of DHTML'ing the above. Possibly also add a check for the selected city and set a class for the relevant city link for highlighting.
> I tried it with uri.action view helper in a ForEach loop:
> <f:for each="{cities}" as="city"><a href="{f:uri.action(action:'result',arguments:{demand:{city:city}})}">{city.name}</a></f:for>
>
> But this alway leads to a HMAC check error. Maybe a could write a view helper of my own which sets the HMAC correctly?
You should avoid doing that at all cost, IMHO.
Cheers,
Claus
More information about the TYPO3-project-typo3v4mvc
mailing list