Edelweiss Styleguide

Styleguide Navigation

Form Kit

Please refer to library documentation for Schema, Validation and Inputs.

Also don't be shy playing around: FormKit Playground

FormKit expects a configuration with the following properties:

  • schema - a schema object array
  • action - a string representing the action url
  • method - a string representing the method (GET or POST)
  • recaptchaSitekey - a string representing the recaptcha enterprise sitekey

Before submitting the form, we will first get a token from Google. Because of this, we will not use the native form submission, but rather asynchronously send the form data (via `fetch`) to the action url. We expect either an HTML response (which will replace the current form, not the entire page! But only for status codes below 300), or a JSON response with one of the following properties:

  • result - HTML to replace the current form
  • redirect - a string representing the url to redirect to
  • errors - an object like this
    // Arg 1 is form-wide errors
    ['There was an error in this form'],
    // Arg 2 is field-specific errors
    {
        username: 'Sorry, that username is not available.',
    }
    
    
    

Schema JSON