0

I am using Java EE 5, JSF 1.2, JQuery and JavaScript.

I have a form that contains two buttons, and each button has to submit different things. Here's a very simple example of what I have.

<h:form>
    <h:inputText id="emailInput" value="#{MyBean.Email}" required="true"/>

    <h:commandLink id="accept" action="#{MyBean.Accept}">
        <h:outputText value="Accept"/>
    </h:commandLink>

    <h:commandLink id="cancel" action="#{MyBean.Cancel}">
        <h:outputText value="Cancel"/>
    </h:commandLink>
</h:form>

I can't separate them into two forms. I need a way to make it so that if the Accept button is clicked, the email is submitted, but if the Cancel button is clicked, is submits nothing.

Any ideas?

Thanks!

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Nacho321
  • 1,911
  • 7
  • 33
  • 55
  • Is this acceptable as dupe? http://stackoverflow.com/questions/6062923/how-to-skip-validation-when-a-specific-button-is-clicked/ – BalusC Jul 22 '15 at 21:19
  • I'm not sure. If I add "immediate" to the cancel button, it won't validate, but it will still submit the email input field to the bean. I was wondering if there was something like the "execute" method that f:ajax provides, but for JSF 1.2. I'm still looking into it :P – Nacho321 Jul 23 '15 at 19:29

0 Answers0