[TYPO3-mvc] Error using link.action, while form.submit works

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Nov 8 12:19:48 CET 2010


Hey,

...
> Tx_Myext_Domain_Model_Demand extends
> Tx_Extbase_DomainObject_AbstractValueObject
>
> For scrolling in the result set I need a link to show the previous (or
> the next) couple of items (same action, same view, different offset).
>
> The link I try to use is following:
> <f:link.action action="find"
> arguments="{demand: demand, count: count, offset: prev}">
> prev
> </f:link.action>
>
> But this results infollowing error:
> Uncaught TYPO3 Exception
> #1251730701: The value must be of type "Tx_Myext_Domain_Model_Demand",
> but was of type "NULL".

well, how does the URI look like? I think the link viewHelper has issues 
in converting your demand object to a array that can be passed via URI.

> Whe I use a form with an submit button it works:
> <f:form class="tx_myext_searchform" method="post" action="find"
> name="demand" object="{demand}"
> arguments="{count: count, offset: prev}" >
> <f:form.hidden id="searchTitle" property="searchTitle" />
> <f:form.hidden id="searchCountries" property="searchCountries" />
> <f:form.submit name="submitButton" id="prevButton" value="prev" />
> </f:form>

Of course this works, because you explicitly set the properties of your 
demand object that shall be submitted. The generated link seems to miss 
that properties.

> What I am doing wrong with the link generation?

See above. When I'm in need of something like this, I implement a 
"getAsArray" method in my demand (you could also create a viewHelper for 
this) and only pass the demand values as array to the linkViewHelper:

<f:link.action ... arguments="{demand: demand.asArray}" />

Of course it would be nice if the linkViewHandler could convert demand 
objects on it's own.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list