immediate=true is set on a jsf command button but still seeing validation
- by Zack Macomber
I have the following command button set up in a facelet:
<h:commandButton action="#{addressAction.deletePreviousAddress}"
value="#{bundle['button.deleteAddress']}"
styleClass="deg-form-button"
immediate="true">
<f:setPropertyActionListener
target="#{addressAction.addressActionForm.previousAddress}"
value="#{address}">
</f:setPropertyActionListener>
</h:commandButton>
In AddressAction, the following code gets run to delete a previous address on the form:
public Enum<NavigationConstants> deletePreviousAddress() {
addressActionForm.getPreviousAddresses().remove(addressActionForm.getPreviousAddress());
return NavigationConstants.addresses;
}
Before I made the address input components "required=true", this code worked fine and removed the previous address from the jsf form successfully. Right now, I can't successfully delete a previous address because validation is occurring and stating that the input components need to be filled in on the previous address record on the form.
How can I bypass this validation? I thought the "immediate=true" attribute on the command button would have accomplished it but that's not cutting it in my case...