immediate=true is set on a jsf command button but still seeing validation

Posted by Zack Macomber on Stack Overflow See other posts from Stack Overflow or by Zack Macomber
Published on 2012-11-28T17:02:53Z Indexed on 2012/11/28 17:03 UTC
Read the original article Hit count: 258

Filed under:
|

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...

© Stack Overflow or respective owner

Related posts about validation

Related posts about jsf