All error messages disappear when value is entered on one textbox

后端 未结 1 2012
孤独总比滥情好
孤独总比滥情好 2020-12-12 05:25

I have following form with jquery validate.

  1. When I submit the form without entering any values, it shows error messages. But when I enter value in “Amount”

相关标签:
1条回答
  • All error messages disappear when value is entered on one textbox

    From the documentation for showErrors:

    The arguments contain only those elements currently validated, which can be a single element when doing validation onblur on focusout or keyup.

    As you can see, the showErrors option is working as designed. The new map of messages does not retain the previous messages after new validation is completed. If one field is validated, then the map only contains the message for the one field, etc.

    Just use wrapper and errorLabelContainer options, which, when used together, were designed to automatically keep an updated list of pending messages for the whole form...

    wrapper: "li",  // <- the LABEL will be inside of this
    errorLabelContainer: "#errorSummaryList",  // <- your UL element
    

    DEMO: jsfiddle.net/y9o8du3q/

    0 讨论(0)
提交回复
热议问题