Kindly assist to send formdata to EmailJS. Can unfortunately not get it to work. Multi step form and validation in JS the problem. I have used the correct user ids etc when I tested the code. No mails send when I submit.
Html code(multi step form)
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/emailjs-com@2.4.1/dist/email.min.js"></script>
<script type="text/javascript">
(function(){
emailjs.init('YOUR_USER_ID');
})();
</script>
<script type="text/javascript">
window.onload = function() {
document.getElementById('contact-form').addEventListener('submit', function(event) {
event.preventDefault();
emailjs.sendForm('contact_service', 'contact_form', this);
});
}
</script>
</head>
<form id="contact-form">
<v-card-actions>
<v-layout justify-center>
<v-btn class="teal accent-2" @click.prevent="prev()" v-if="step > 1">Prev</v-btn>
<v-btn class="teal accent-2" @click.prevent="next()" v-if="step < 4">Next</v-btn>
<v-btn dark class="teal accent-5" type="submit" v-if="step === 4" @click.prevent="validateBeforeSubmit()">Submit</v-btn>
</v-layout>
JS file(Validation in JS)
validateBeforeSubmit() {
this.$validator.validateAll().then(result => {
if (result) {
this.message = "Submission completed.";
this.submitted = true;
????????? Do I call EmailJS from here? How?
return;
}
});
}