DynaForm - Field value not updated

Community Driven Extensions Project
Post Reply
Babas007
Posts: 251
Joined: 24 May 2011, 09:42

09 Jun 2016, 09:44

Hi,

I'm using DynaForm and facing a very weird issue. I basically have this field and other in my form:

Code: Select all

<pe:dynaFormControl type="TEXTAREA">
                <p:inputTextarea id="ita" autoResize="false"
                    style="height:70px;width:400px;"
                    styleClass="#{cc.attrs.styleClass}"
                    value="#{dyna[formField.property.name]}"
                    <f:validator validatorId="formFieldValidator" />
                    <f:converter converterId="formFieldConverter" />
                    <f:attribute name="formField" value="#{formField}" />
                </p:inputTextarea>
</pe:dynaFormControl>
When I submit the form, some of textarea are updated with the updated value and some are not (conversion and validation goes fine). By debugging, I realized that, it's not updated in the call of grandkid.processUpdates(context): DynaForm line 296 as it's call UIInput.updateModel(FacesContext context) because the local value is not set (it's is valid though)! Here the condition:

Code: Select all

if (!isValid() || !isLocalValueSet()) {
      return;
}
I'm trying to debug what it's going on and I'm stuck in the implementation of AbstractDynamicData.setData(KeyData keyData). Could you explain a bit please:

Code: Select all

public void setData(KeyData keyData) {
        if (data != null) {
            saveDescendantState();
        }

        data = keyData;
        exposeVar();

        if (data != null) {
            SavedEditableValueState();
        }
}
SavedEditableValueState is correctly saved, but in SavedEditableValueState() method, the SavedEditableValueState is retrieved but not with the saved values. I suspect it has been reset somewhere between these two calls. And indeed, that's what's happening, AbstractDynamicData.processDecodes(FacesContext context) is called and do this:

Code: Select all

for (SavedEditableValueState saveState : saved.values()) {
      saveState.reset();
}
On last thing, my DynaForms are called in a ui:repeat, could it be a reason?

Code: Select all

<ui:repeat var="zone" value="#{cc.attrs.displayForm.zones}">
      <pe:dynaForm>
            <pe:dynaFormControl type="TEXTAREA" />
            // etc.
      </pe:dynaForm>
</ui:repeat>
Probably related to this issue: https://github.com/primefaces/primefaces/issues/998

It looks like it could be the problem actually, because the only textareas updated are those contained in the last iteration

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

09 Jun 2016, 13:44


Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests