[TYPO3-mvc] How to dynamically create objects

Joerg Schoppet joerg at schoppet.de
Sat May 18 15:46:57 CEST 2013


Hi,

I hope someone can help me on this.

I created models where an order has n positions.

In the "new" view of my order I want to give the user the possibility to dynamically add positions.

My "new" form looks like this (shortend)

<f:form action="create"  name="newOrder" object="{newOrder}">
<f:render partial="Order/FormFields" />
<table>
<tr id="position1">
<td><f:form.textfield name="newOrder[positions][1][count]" type="number"  /></td>
</tr>
</table>
</f:form>

This is working as it should.

Now I added a little bit of javascript to dynamically add new positions like
<tr id="position2">
<td><f:form.textfield name="newOrder[positions][2][count]" type="number"  /></td>
</tr>

And changed my "createAction" annotation to "@dontvalidaterequesthash".

But now, as soon as I add a second position and transmit I get the error:
Exception while property mapping at property path "positions":It is not allowed to map property "2". You need to use $propertyMappingConfiguration->allowProperties('2') to enable mapping of this property.



Help please!!!



Joerg


More information about the TYPO3-project-typo3v4mvc mailing list