HTML/[removed] Simple form validation on submit

后端 未结 6 2161
北荒
北荒 2020-11-29 05:40

I\'m trying to validate my form with the easiest way possible, but somehow it is not working and when I click submit it just takes me to the next page without giving the ale

6条回答
  •  情话喂你
    2020-11-29 05:51

    You need to return the validating function. Something like:

    onsubmit="return validateForm();"
    

    Then the validating function should return false on errors. If everything is OK return true. Remember that the server has to validate as well.

提交回复
热议问题