Skip to content

Confirm: p:confirm does not work with type=button CommandButton #13736

@mlarue

Description

@mlarue

Describe the bug

We have a p:commandButton with type="button" that is used to close another dialog with Javascript.

Since updating to PF14 this does not work anymore.

Clicking "Yes" does nothing and leaves the button in an unusable state.

Removing type="button" restores the expected behavior, but causes an unnecessary request to be sent, which should be avoided.

Possibly related:

Reproducer

            <p:commandButton type="button" value="Execute JS" onclick="console.log('executed')">
                <p:confirm message="really?"/>
            </p:commandButton>

            <p:confirmDialog global="true">
                <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
                <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
            </p:confirmDialog>

pf-test-confirm.tar.gz

Expected behavior

Execute the script specified in "onclick" upon confirming.

Worked with PF11. Unfortunately I can't get my primefaces-test reproducer to work with PF11 to verify this behaviour again.

PrimeFaces edition

None

PrimeFaces version

14.0.12

Theme

No response

JSF implementation

Mojarra

JSF version

4.0

Java version

21

Browser(s)

No response

Metadata

Metadata

Assignees

Labels

🐞 defectBug...Something isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions