DynaForm nested mode submit

Community Driven Extensions Project
Post Reply
techniata
Posts: 13
Joined: 20 Apr 2011, 10:10

21 Mar 2017, 21:02

Hi,

I am trying to create a dynamic form with nested models in separate panels/tabs. When I am submitting the parent form the nested forms are not submitted.

Code: Select all

<pe:dynaForm id="dynaForm" value="#{dynaFormController.parentModel}"
	var="model">
	<pe:dynaFormControl type="nestedModel">
		<p:panel header="test" toggleable="true">
			<pe:dynaForm value="#{model}" var="data">

				<pe:dynaFormControl type="input" for="txt">
					<p:inputText value="#{data.value}" required="#{data.required}" />
				</pe:dynaFormControl>

				<pe:dynaFormControl type="select">
					<p:selectOneMenu value="#{data.value}">
						<f:selectItems value="#{data.values}" />
					</p:selectOneMenu>
				</pe:dynaFormControl>

				<pe:dynaFormControl type="booleanchoice">
					<p:selectBooleanCheckbox value="#{data.value}" />
				</pe:dynaFormControl>

			</pe:dynaForm>
		</p:panel>
	</pe:dynaFormControl>
	<f:facet name="buttonBar">
		<p:commandButton process="dynaForm" value="Submit"
			actionListener="#{dynaFormController.submitForm()}"></p:commandButton>
	</f:facet>
</pe:dynaForm>
Here is the java code:

Code: Select all


parentModel = new DynaFormModel();

		DynaFormRow fprow = parentModel.createRegularRow();

		DynaFormModel nestedModel = new DynaFormModel();
		DynaFormRow nestedRow1 = nestedModel.createRegularRow();

//first is a testobject created earlier
		nestedRow1.addLabel("Name: ");
		nestedRow1.addControl(first.getName(), "input");
		nestedRow1.addLabel("Sirname: ");
		nestedRow1.addControl(first.getSirname(), "input");
		nestedRow1.addLabel("bool: ");
		nestedRow1.addControl(first.getBool(), "booleanchoice");

		fprow.addControl(nestedModel, "nestedModel");

		
Is it possible to accomplish this? Or how is it possible to include accordion/panel/tab in dynaform?

Thank you in advance


Using:

Code: Select all

<dependency>
	<groupId>org.primefaces</groupId>
	<artifactId>primefaces</artifactId>
	<version>6.0</version>
</dependency>
<dependency>
	<groupId>org.primefaces.extensions</groupId>
	<artifactId>primefaces-extensions</artifactId>
	<version>6.0.0</version>
</dependency>

Babas007
Posts: 178
Joined: 24 May 2011, 09:42

22 Mar 2017, 00:22

1/ Where do you initialize your model?

2/ A lot of fixes have been provided since, try with the latest source please

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest