[TYPO3-dev] Dynamic inputs Extbase/Fluid

jc Collin jc.collin2 at gmail.com
Thu Nov 13 13:59:29 CET 2014


hello,
I have a controller that allows me to create an entry.
This entry has multiple relationships m : n .

I created a single form that allows me to insert elements one of which has a relation m : n with this input ( contact )

When I use the " formfields " basic form multiple select, my insertions are going well.

FLUID
-------------------------------------------------------------------
   <div class="form-group">
    <label for="contact">
        <f:translate key="tx_annuaire_domain_model_entite.contact" />
    </label>
    <f:form.select class="form-control"  name="contact" property="contact" options="{contact}" sortByOptionLabel="uid" optionValueField="uid" optionLabelField="nom" multiple="true"/>
</div>
-------------------------------------------------------------------


HTML
-------------------------------------------------------------------
<input type="hidden" name="tx_annuaire_annuaire[newEntite][contact]" value="">
<select class="form-control" multiple="true" name="tx_annuaire_annuaire[newEntite][contact][]">
<option value="1"></option>
etc ...
</select>
-------------------------------------------------------------------

 wish for better ergonomics give the user the ability to create contacts and they are added to the form.

In addition I go through the ajax .
The creation of the contact item goes well and is successfully created in the database.
By cons when I submit the main form, the relationship is not added mm in the corresponding table contacts_mm

My question: how to format inputs that will add to form the basis for the increment based relationship mm type :
-------------------------------------------------------------------
<input id="1" name="tx_annuaire_annuaire[newEntite][contact][] value="uid_recupere_par_ajax_1">
<input id="2" name="tx_annuaire_annuaire[newEntite][contact][] value="uid_recupere_par_ajax_2">
<input id="3" name="tx_annuaire_annuaire[newEntite][contact][] value="uid_recupere_par_ajax_3">
<input id="4"name="tx_annuaire_annuaire[newEntite][contact][] value="uid_recupere_par_ajax_4">
-------------------------------------------------------------------

I modified the controller to authorize the properties on "contact" but it does not work .

PHP CONTROLLER
-------------------------------------------------------------------
        protected function initializeCreateAction() {
      
        if ($this->arguments->hasArgument('newEntite')) {
            $configuration = $this->arguments['newEntite']->getPropertyMappingConfiguration();
            $configuration->allowAllProperties();
//OR
            $configuration->allowProperties('contact');

}
----------------------------------------------------------------------

Someone has an idea ?



More information about the TYPO3-dev mailing list