Input fields validation

Input fields validation

Hi All,

I am looking for a solution for checking input fields on a simple form (I have got 4 inputs and 3 of them are required - using DNN Dynamic Form)
What I would like to achieve is to prevent the user to hit the submit button, as the form opens in a dropdown, and if the user clicks the submit button the page refreshes, givinng the impression for the user that the fomr has been submitted.

I have found a solution on stackoverflow and have managed to achieve the following: when the user hovers over the sumbit button an alert window pops up if one of the fields is empty.
The problem is when the user doesn`t fill in 2 fields and hovers over the submit button 2 separate alert box shows up. How I would like to achieve is just showing the alert message only once.
Here is my code:
  1. $('#dnn_ctr503_DynamicForms_lnkSave').on('mouseover',function()
  2. {
  3.     if( $('#dnn_ctr503_DynamicForms_TBR_GUIDaa4a3017-b28d-46d2-ae6e-7d56b2b886c5Name').val().length === 0 ) {
  4.         alert('Please fill in all required fields(*)!');
  5.     }
  6. if( $('#dnn_ctr503_DynamicForms_TBR_GUID35b841a2-5019-4cb0-9041-1204c90e5bebEmail').val().length === 0 ) {
  7.         alert('Please fill in all required fields(*)!');
  8.     }
  9. if( $('#dnn_ctr503_DynamicForms_TBR_GUIDfb4cb1b0-30b9-475f-bb92-7c3d35275e55Message').val().length === 0 ) {
  10.         alert('Please fill in all required fields(*)!');
  11.     }
  12. });
How can I re-write it so all of it is combined into one 'if event' which checks all 3 inputs heve been filled in?
Many thanks.