vendredi 5 juin 2015

DynaForm Primefaces extensions gather submitted data

I am using DynaForm in Primefaces extensions. I have generated a dynamic form, but the problem is how to recover the submitted data from the controller.

Here is how I am generating my form:

this is the controller side

    model = new DynaFormModel();  

    DynaFormRow row;

    allfieldMessageList=getAllfieldMessageList();

    for(FilledMessageField f:allfieldMessageList)
    {
    // 1. row  
    row = model.createRegularRow();  
    FilledMessageField fmf=new FilledMessageField();
    DynaFormLabel label11 = row.addLabel(fmf.getField().getName());  
    DynaFormControl control12 = row.addControl(fmf, "input");  
    label11.setForControl(control12);  
    }

and this is the web page side:

<h:form id="addMessageIDForm" rendered="true">
        <pe:dynaForm id="dynaForm" value="#{messageValuesController.model}" 
            var="data" widgetVar="dynaFormWidget" >     
            <pe:dynaFormControl type="input" for="txt" >
            <p:panelGrid columns="2">
                <p:inputText id="txt" value="#{data.value}"
                    required="#{data.required}" />
                    </p:panelGrid>
            </pe:dynaFormControl>
        </pe:dynaForm>
       <p:commandButton value="Submit" action="#{messageValuesController.saveMessageTemplate}" process="dynaForm"  />  
</h:form>

Please does any one have any idea about this ?

Thank you.

Aucun commentaire:

Enregistrer un commentaire