Search code examples
htmljsfrichfaces

Is there a way to use a a4j:commandButton without generating type=submit?


I have 2 buttons:

                        <a4j:commandButton
                            execute="@this"
                            value="clear"
                            immediate="true"
                            render=":thisForm :anotherForm"
                            action="#{myMB.clearFields}" />

                        <a4j:commandButton
                            value="execute"
                            type="submit"
                            action="#{myMB.executeAction}"
                            render=":anotherForm" />

And both are generating inputs with type="submit". But I would like the key to execute the second button. Is there a way to change the type for the first button?


Solution

  • <a4j:commandButton
        type="button" .../>
    

    on the first button should do the trick.

    type - Type of button to create. Can be one of "submit", "button", "image" and "reset". If not specified, the default value is "submit".

    Refer to component reference for more details.