Help with validation on submit

Help with validation on submit

I have 2 forms that share a submit button. I have that part worked out, what I'm having trouble with is adding the validation to each form. Here is what I have, I have not done validation inside a submit function before, but usually on document ready.

$("#sbtBtn").click(function() {
         
if($("input[name=license_code]").val()) {
            $
("#formOne").submit();
         
} else if ($("input[name=referred_by_text]").val() && $("input[name=broker_text]").val() && $("input[name=email1]").val()) {
            $
("#formTwo").submit();
         
}
           
else {
           
//need help getting this added as an error message
             alert
("Please fill out either the returning user or new user form");  
           
}

   

});

        $

("#formOne").submit(function() {
           
//need to put validation and AJAX submit here
       
});

        $

("#formTwo").submit(function() {
           
//need to put validation and AJAX submit here
   
});


I appreciate any help, as Ive only been successful with AJAX forms that don't share a button before. thanks!

also, how would I add a fourth conditional that if all elements are filled out, display error message "You can only submit one at a time"



Kane Leins