Reputation: 1088
Method submitReg() should trigger when the button p-button is clicked, but it doesn't. I have two submit buttons at the bottom of my form. The one called "add" which works, but the Request Access does not invoke the submitReg() method, why?
<form v-on:submit="submitReg">
<fg-input v-model="form.email" addon-left-icon="nc-icon nc-email-85" placeholder="Email..."></fg-input>
<fg-input v-model="form.password" type="password" addon-left-icon="nc-icon nc-key-25" placeholder="Password..."></fg-input>
<p-checkbox class="text-left" v-model="form.acceptTerms">
I agree to the
<a href="#something">terms and conditions</a>.
</p-checkbox>
<p-button slot="footer" type="submit" round>Request Access</p-button>
<button slot="footer" type="submit">Add</button>
methods
methods: {
submitReg(e) {
console.log(this.form.email);
alert("here")
},
toggleNavbar() {
document.body.classList.toggle('nav-open')
},
closeMenu() {
document.body.classList.remove('nav-open')
document.body.classList.remove('off-canvas-sidebar')
}
},
Upvotes: 1
Views: 108
Reputation: 1067
Try this :
<form v-on:submit="submitReg">
by <form @submit.prevent="submitReg">
submitReg(e){ console.log(this.form.email); alert("here") },
by
submitReg(){ alert("here") },
Upvotes: 1