Can't make the validation work in Bootstrap 4

前端 未结 2 349
旧巷少年郎
旧巷少年郎 2020-12-08 10:31

I\'m trying to implement validation by Bootstrap and I\'ve pasted the following sample on my page:

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 11:16

    It appears the validation changes again in the final release version of Bootstrap 4: http://getbootstrap.com/docs/4.0/components/forms/#validation.

    It becomes more complicated than I thought.

    Custom style client side validation is recommended:

    1. When validated, the form adds a class named was-validated.
    2. Feedback messages are wrapped within .valid-feedback or .invalid-feedback.

    For server-side validation:

    1. No need for was-validated class on the
      tag.
    2. Add .is-valid or .is-invalid on the input control.
    3. Add .invalid-feedback or .valid-feedback for the feedback message.

提交回复
热议问题