How to only submit form if validation passes?
I am hoping to add some validation in to check whether certain fields are null if some are filled out. Unfortunately just using the required field isn't enough for this as I don't want to always make it mandatory, I just want to make certain fields mandatory if some are filled out. For example:
Email Address
Description
Both of the above fields are optional, however if a description is entered I want to validate that there is also a value for Email Address on submitting the form. I have this part of the script complete I believe.
I am hoping for some assistance on how to only submit the form if the validation passes. At the moment I have it set up as two different mouse up actions (Run a Javascript & Submit a Form) meaning that they're independent of eachother and it still submits the form even when the validation fails and an alert is brought up. So I am seeking help in writing the submit a form logic in my JavaScript file if anyone can lend a hand.
