So I have this jQuery for my form:

```
frm.submit(function(event) {

  validateForm();

  if(validateForm()) {
    $(this).submit();
    } else {
    event.preventDefault();
  }

});

```

It does sort of work, but I get JS `<error>` (and it doesn't say anything else in the console about it), I think the reason is that the function has to go through the validation again? Kind of like a circular dependency.

Can you show me a better way to do the exact thing that I'm trying to achieve here please?

1. Validate and show errors if filled in the wrong way;
2. Submit the form if everything is ok