I have to present one confirmation dialog on button click. The form has a field which is validated in bean.
<input type="text"
jsf:value="#{bean.userName}"/>
<button jsf:action="#{bean.deleteUser}"
jsf:onclick="return confirm('Are you sure?')">
Delete User
<f:ajax execute="@form"
render="@form"
onevent="commonEvent"/>
</button>
The field is manadatory in bean.
@NotEmpty()
@Email
public String getUserName() {
//getters
}
Here the confirm dialog appears before the input field is validated. Is there any way that confirm dialog shall appear only after the validation is success.
Is it possible to write this without changing the commonEvent.