[TYPO3-mvc] Creating Multiple Objects with a single view

Nathan Lenz typo3 at k9tfk.com
Mon Dec 28 18:45:33 CET 2009


If I have a Recipe that has a name and a list of Ingredients.  Is it
possible to create a single view that allows content editors to create
the recipe and "n" Ingredients all at the same time?

Here is the simplified form for creating a new recipe, but I'm trying
to figure out how to allow the user to create lots of ingredients.

<f:section name="content">
	<h2>Create a new Recipe</h2>
	<f:render partial="formErrors" arguments="{for: 'newRecipe'}" />
	<f:form method="post" controller="Recipe" action="create"
name="newRecipe" object="{newRecipe}">
		<label for="name">Name <span
class="required">(required)</span></label><br />
		<f:form.textbox property="name" /><br />	
	</f:form>
</f:section>


For the sake of this example, lets pretend "Ingredient" has two
properties: amount and food. ("1 banana")

What would the syntax be for adding this?  I was thinking something like
this, but it didn't work...

<f:from.textbox property="ingredients[0][amount] />
<f:form.textbox property="ingredients[0][foot]" />

<f:from.textbox property="ingredients[1][amount] />
<f:form.textbox property="ingredients[1][foot]" />

(With javascript for creating additional ones...)


A good place for an example of this could be in the blog_example. If an
editor could create a new post and assign muliple(unlimited) tags
without multiple submits.

Any hints?
--Nathan





More information about the TYPO3-project-typo3v4mvc mailing list