Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

Uncaught (in promise) TypeError: e.preventDefault is not a function

argh, why am I getting this?

my vee-validate form

<Form @submit.prevent="onSubmit">

Method:

onSubmit() {
      this.contact = {
        first_name: this.first_name,
        last_name: this.last_name,
        email: this.email,
        phone: this.phone,
        address: this.address,
        town_city: this.town_city,
        region_county: this.region_county,
        country_code: this.country_code,
        post_code: this.post_code,
      };
      try {
        if (!this.editing) {
          axios
            .post(
              "https://CREATEAPI",
              this.contact
            )
            .then(() => {
              this.alertShow = true;
              this.alertClasses =
                "bg-green-300 rounded border-2 border-green-500 p-2 my-2";
              this.alertText = "Success, your contact has been added!";
            });
        } else {
          axios
            .put(
              `https://UPDATEAPI/${this.contactDetails.id}`,
              this.contact
            )
            .then(() => {
              this.alertShow = true;
              this.alertClasses =
                "bg-green-300 rounded border-2 border-green-500 p-2";
              this.alertText = "Success, your contact has been updated!";
            });
        }
      } catch (error) {
        console.log("ERROR: ", error);
      }
    },
0 likes
2 replies
boyjarv's avatar

So after implementing VEE-VALIFDATE, I rebuilt my application using npm run serve

and now I get:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'split')

Please or to participate in this conversation.