javascript - How to submit without closing the rich popup panel? -


<rich:popuppanel modal="true">     <h:form         id="mymodal"         onkeypress="if (event.keycode == 13) {                 alert('ok10');                 $( &quot;[name$='modalconfirmbutton']&quot;).click();                 if (typeof evt.stoppropagation != 'undefined') {                     evt.stoppropagation();                 } else {                     evt.cancelbubble = true;                 }                 return true;             }"                  <a4j:commandbutton                     value="cancel"                     immediate="true"                     onclick="#{rich:component(cc.attrs.idmodal)}.hide(); return false;" />                  <a4j:commandbutton                     id="modalconfirmbutton"                     value="confirm"                     action="#{mb.confirm}" /> 

if click 'confirm' button using mouse, validate form, , not close if there errors. but, if press enter, not validate, , close it. if put 'cancel' button after 'confirm' button, validade, show errors, still close.

any idea how make 'enter' key work mouse click 'confirm'?

you should validate against submit form event, not dependant on mouse-click or enter key-press. behaviour want, associated button only. if move onsubmit form, should work.


Comments