There’s a button which only purpose is to call modal panel.
How to avoid form submission?
Exemplary code:
<a4j:commandButton onclick="Richfaces.showModalPanel('noAccess');"/>
And there’s a modal panel definition like below:
<rich:modalPanel id="noAccess" autosized="true" moveable="true" >
<f:facet name="header">
<h:outputText value="Hello!" />
</f:facet>
<p>Some meaningful message.</p>
<a onclick="Richfaces.hideModalPanel('noAccess');" href="#">Close</a>
</rich:modalPanel>
Thing is, clicking a button triggers full processing cycle. I’d like to display modal only, and if possible completely skip submission. Button is located in form and there’s no way to move it out.
How to avoid submission in that case and do the work on client’s side?
Add
return false;at the end ofonclickattribute as below.