[TYPO3-mvc] Create multiple objects with one form using fluid

Henjo Hoeksma | Stylence me at henjohoeksma.nl
Mon Mar 11 22:48:26 CET 2013


Hi Søren,

I sent you an email...

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Mon, Mar 11, 2013 at 9:51 PM, "Søren Andersen" <hacksaw at zpeed.dk> wrote:

> Hi Henjo,
>
> Sounds great that you have accomplished this on several occassions.
>
> I worked a bit on this problem today, but I have no code to show yet.
> Still trying to understand the correct approach conceptually.
>
> What I want is to build a form like this:
> Amount of type1: <input1> [+]
> Amount of type2: <input2> [+]
> Amount of type3: <input3> [+]
>
> Each line should be made into a model of type Registration.
>
> Ideally the user should be able to click the plus sign, to add another
> line of the type, if that is necessary.
>
> What I did today was to create a new model called AllowedTypes, which I
> populate with the types the user can register on.
>
> I can iterate and output a list of types, but have no idea how to
> structure the form in fluid. One of my issues is, if I have 3 types, I
> somehow need to distinguish these from each other. Normally I would do
> something like tx_myplugin_pi1[registration][1][type] and put it in a
> hidden input, and a corresponding text input for quantity.
>
> Of course I can iterate the request in the controller, but if there's a
> better way to do it I would love to know.
>
> Henjo, you wouldn't happen to have some public code, where you create
> multiple objects from one form?
>
> Sincerely,
> Søren Andersen
>
> > Hi Søren,
> >
> > I do not see why this is not possible... I have done it on several
> > occasions. No need to parse it in your controllers...
> > Maybe share a github repo so we can see some code?
> >
> > Kind regards,
> >
> > Henjo
> >
> > Problems are small because we learned how to deal with them.
> > Problems are big because we need to learn how to deal with them.
> >
> >
> > On Sun, Mar 10, 2013 at 9:49 AM, Daniel Lienert <daniel at lienert.cc>
> wrote:
> >
> >> Hey Søren,
> >>
> >> As i know, there is no extbase-magic way to generate a variable amount
> >> of
> >> objects within one "create"-call. My suggestion would be to create the
> >> objects by-hand within your create method by using the extbase request
> >> object to retrieve the array of submitted data. Validating the input and
> >> the objects manually should not be a problem, as your model seems to be
> >> very simple.
> >>
> >> Greetings, Daniel
> >> --
> >> TYPO3 related: http://daniel.lienert.cc | http://yag-gallery.de
> >>
> >> ______________________________**_________________
> >> TYPO3-project-typo3v4mvc mailing list
> >> TYPO3-project-typo3v4mvc@**lists.typo3.org<
> TYPO3-project-typo3v4mvc at lists.typo3.org>
> >> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> >> project-typo3v4mvc<
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
> >>
> > _______________________________________________
> > TYPO3-project-typo3v4mvc mailing list
> > TYPO3-project-typo3v4mvc at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> >
>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list