logo

FormGuardJS
Demo Examples

FormGuardJS - Try It Live in Action

{{ demoContent.c1 }}

Basic Form Integration with FormGuardJS

{{ demoContent.c2 }}

synchronous validation Example:

{{ demoContent.c3 }}

Asynchronous Validation Example:

Important Note: When using FormGuardJS, the library automatically handles the form validation and submission process, including preventing the default form submission behavior. However, when you define a custom onSubmit handler, you must manually call event.preventDefault() to prevent the default submission behavior and ensure your custom logic (e.g., using fetch to send data to an API) is executed correctly.

Below is the complete code used to implement validation for a sample form, including rules for various input types and a working onSubmit asynchronous callback. You can use this as a reference for your projects.

{{ demoContent.c8 }}