Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In PrimeFaces (4.0) confirm dialog, how do I ensure 'No' is in focus by default?

As you can see from the image below, 'yes' button gets the primary focus. Can you ensure that 'No' is in focus without swapping the buttons around, perhaps with an attribute?

enter image description here

like image 503
chinto Avatar asked Apr 23 '15 01:04

chinto


1 Answers

As far as I know, the only way is to swap the buttons in the xhtml. But you can keep the order of appearance in the dialog with float:left on the Yes button.

<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
    <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
    <p:commandButton value="Yes" type="button" style="float:left;" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
</p:confirmDialog>
like image 136
ForguesR Avatar answered Nov 18 '22 01:11

ForguesR