DynaForm bug?

Community Driven Extensions Project
Post Reply
estatian
Posts: 3
Joined: 17 May 2016, 19:14

27 Jun 2016, 13:05

The following stopped working when i upgraded Extensions from v4.0.0 to v6.0.0:

Code: Select all

<pe:dynaForm id="dynaForm" value="#{prospectController.model}" var="field" widgetVar="dynaFormWidget" openExtended="${prospectController.extended}">

	<pe:dynaFormControl type="ynToggleExtended" for="yn" >
		<p:selectOneRadio id="yn" value="#{field.value}" required="${field.required}" onchange="PF('dynaFormWidget').toggleExtended()" >
			<f:selectItems value="#{field.selectItems}"/>
		</p:selectOneRadio>
	</pe:dynaFormControl>

	<! -- additional control definitions -->

</pe:dynaForm>
The variable field is of custom type FormField, with the obvious getters and setters.

Code: Select all

SelectItem no = new SelectItem(Boolean.FALSE, "No");
SelectItem yes = new SelectItem(Boolean.TRUE, "Yes");

this.extended = value != null && !value.isEmpty();
FormField questionField = new FormField(this.extended, false, Arrays.asList(no, yes));

DynaFormRow questionRow = this.model.createRegularRow();
DynaFormLabel questionLabel = questionRow.addLabel(question, 1, 1);
DynaFormControl questionControl = questionRow.addControl(questionField, "ynToggleExtended", 1, 1);
questionLabel.setForControl(questionControl);
When rendering the page all is well; the correct radio button gets selected depending on whether value is non-empty, the dynaForm is correspondingly extended (or not), and all is sweet.

Problem is, when the form is later submitted, field.value is always set to null regardless of which radio button is selected. That is, neither Boolean.FALSE nor Boolean.TRUE appears to be recognised by the selectOneRadio. However, downgrade to Extensions v4.0.0 without any other changes and it all works smoothly again.

I might also add that setting field.required to true apparently makes validation fail, as both radio buttons are immediately unselected on submit.

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

01 Jul 2016, 09:58

Add your controller code please

pzoli
Posts: 100
Joined: 27 Feb 2012, 20:52
Location: Hungary
Contact:

09 Jul 2016, 14:21

I've got the same issue. I tried to add a hidden dummy dynaFormControl field at first, and after that the process send the second and other field values. I test it with wildfly 10.0.0 and mojarra 2.2.12, wildfly 9.0.2 myfaces 2.2.8 with the same result. I uploaded the code to github (https://github.com/integrityhu/Homework4PFExtDynaForm). Please visit this project and help resolve the issue.
JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL

pzoli
Posts: 100
Joined: 27 Feb 2012, 20:52
Location: Hungary
Contact:

14 Jul 2016, 13:32

JBoss Developer Studio 11.3.0.GA
Eclipse Oxygen
Wildfly 11
PrimeFaces 6.2.3, PrimaFaces Extensions 6.2.3
Mojarra 2.2.11-jbossorg-1, MyFaces 2.2.8, Deltaspike 1.7.1
MySQL, Oracle, MS-SQL, PostgreSQL, NoSQL

cassiafn
Posts: 3
Joined: 16 Mar 2016, 20:08

02 Aug 2016, 16:38

I'm having this problem too.
Glad you guys reported it.
Waiting on a new Dynaform version to correct this.

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests