Topic: Submit form after validation

Святослав Иванов priority asked 2 years ago


Hello. I am performing the actions as indicated by the link. I would like to know how to submit the form after successful validation? If I specify the value of the submit property (code below), then the form is sent without verification

  <form>
  <MDBRow tag="form" ref="form" class="g-3 needs-validation" novalidate @submit.prevent="checkForm"  @submit="finishCampaign" >

Mateusz Trochonowicz staff answered 2 years ago


Hi! You can simply add if statement in checkForm function to check, if all inputs and checkbox have any value (which returns true boolean):

  if (
    (input1.value,
    input2.value,
    input3.value,
    input4.value,
    input5.value,
    checkbox1.value)
  ) {
    alert("validated");
  }


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Vue
  • MDB Version: MDB5 3.1.1
  • Device: MacBook
  • Browser: Chrome
  • OS: Mac Os
  • Provided sample code: No
  • Provided link: Yes