Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Nesting forms is illegal in HTML, so also in JSF since all it does is just generating HTML. You need to put them next to each other.</p> <p>If you have multiple buttons in the same form of which you'd like to skip certain validation on certain button press, then add <code>immediate="true"</code> to the button in question. This way all input fields which do <strong>not</strong> have <code>immediate="true"</code> will be skipped.</p> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/questions/4731740/doubt-on-immediate-attribute-for-command-button">What is the <code>immediate</code> attribute used for?</a></li> </ul> <hr> <p><strong>Update</strong>: OK, you want two physically separate forms inside a single form. If splitting the "God Form" in multiple forms with each its own responsibility is not an option, then there are several ways to go around this:</p> <p>If you don't use Ajax and you just have a <code>required="true"</code> on an input element which you actually want to make non-required when you press a certain button, then do:</p> <pre><code>&lt;h:form&gt; ... &lt;h:commandButton value="Submit form but but do not validate comment" /&gt; ... &lt;h:inputTextarea id="comment" required="#{not empty param[foo.clientId]}" immediate="true" /&gt; &lt;h:commandButton binding="#{foo}" value="Submit and validate comment" immediate="true" /&gt; &lt;/h:form&gt; </code></pre> <p>If you actually use Ajax, then just specify the execute region in <code>execute</code> attribute.</p> <pre><code>&lt;h:form&gt; &lt;h:panelGroup id="other"&gt; .... &lt;h:commandButton value="Submit form but but do not validate comment"&gt; &lt;f:ajax execute="other" render="other" /&gt; &lt;/h:commandButton&gt; &lt;/h:panelGroup&gt; &lt;h:panelGroup id="comments"&gt; &lt;h:inputTextarea required="#{not empty param[foo.clientId]}" /&gt; &lt;h:commandButton value="Submit and validate comment by ajax"&gt; &lt;f:ajax execute="comments" render="comments" /&gt; &lt;/h:commandButton&gt; &lt;/h:panelGroup&gt; &lt;/h:form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload