i dont know why your form is submited and if it should be or not, but try do it another way

<h:commandLink action="#{mBean.save}" onclick="return validate()">

return is very importand!

Slawek

Hi,

I have a javascript validation onsubmit of my form. When I click the commandLink the js gets called and throws the alert for validation failure. But the form submits even when the validation fails. Could you please let me know if I am not using this correctly.

SCRIPT:

function validate(){
      if (..){

           }else{
       alert('Validation Error');
       return false;
    }
    return true;
 }

FORM:
<h:form id="frmSave" onsubmit="return validate();">
...
     <h:commandLink action="#{mBean.save}">
          <h:outputText value="Save" styleClass="button-text"/>
    </h:commandLink>
</h:form>

Thanks,
Aruna

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Reply via email to