I have a few codes here of js. And I wanted to put a validation for email and prevents user from submitting a form when it is not valid. Please bear with me since I am new with this technology. Thank you for understanding :)
var session = require('web.session');
var db_name = $("input[name='partner_name']").val();
var contact = $("input[name='contact_name']").val();
var email = $("input[name='email_from']").val();
var url = '/page/website_crm.contactus_thanks';
$(function(){
$("#start_trial").click(function(){ // no idea how to put email validation here
session.rpc('/custom/createaccount', {
db_name : db_name,
contact_name: contact,
email_from: email
});
}).then(function () {
console.log("Creating user account")
});
// that won't proceed here
setTimeout(function (){
window.location = url;
}, 5000);
});