Skip to content

resetValues="true" not working with dynamic fields after form validation errors #5576

@maqjav

Description

@maqjav

Describe the bug

If a form contains fields that are rendered dynamically, when we try to reset them using a button with "resetValues=true", after a validation error has been shown, the dynamic fields aren't reset..

To Reproduce

I added a reproducer that you can execute with this command:
mvn clean jetty:run -Pmojarra40

Steps to reproduce the behavior:

  1. Select the group: Group1
  2. Select the first value: Item1
  3. Select the second value: Item1
  4. Click on Save (an error will be shown because the textfield is required).
  5. Click on Clean
  6. Select the group: Group1

Both selectOneMenus will have the previous value (Item1,Item1).

Expected behavior

Both selectOneMenus should have reset to their original state.

Additional context

The error exists only if the fields are dynamically rendered, otherwise if they are always shown, the form will be reset as expected.

I opened this ticket before primefaces/primefaces#13596 in the Primefaces github (as the reproducer uses it), and they told me there is nothing they can do about this error, and to report it to you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions