Validating required fields before moving to the next page of the form