Javascript is used for the client-side validation. It takes place within the browser. Javascript is used to submit the form data if validation is successful. Validation errors require no extra network trip because form cannot be submitted.
Validation is also carried out in the server after submission. If validation fails, extra network trip is required to resend the form to the client.