Form builder

Create dynamic, responsive, and engaging web forms with ease.

To be able to use the form builder, you will need to specify a form fields template file in your config.

import { Stratox } from './node_modules/stratox/src/Stratox.js';
import { StratoxTemplate } from './node_modules/stratox/src/StratoxTemplate.js';

Stratox.setConfigs({
  handlers: {
    fields: StratoxTemplate,
  }
});

Once a instance of StratoxTemplate has been added to the handlers.fields config object you will be able to use the form builder.

Available form fields

Available form fields out of the box:

  • text (password, tel, email, number... and so on)

  • textarea

  • date

  • datetime

  • hidden

  • select

  • radio

  • checkbox

  • submit (button)

  • group

  • views/componets

And can be combined with all views and components the you have created!

Form field settings

Available form fields out of the box. Se working examples bellow.

Example 1

Begin by adding an element to the HTML document. This is where the template will be loaded.

HTML:

Javascript:

The result

Combine template and form

As long as you are using the same instance then you can combine templates with outher template and template with forms.

Lets add our form to the ingress example in prevous page (Views).

HTML:

JavaScript:

The result

Group form fields

You can even group form fields and components. I will use the ingress as a example again. You can download the CSS class here form my repeat fields:

repeat-fields.css

HTML:

JavaScript:

  • nestedNames:True: This will nest the form name automatically e.g: (customField[0][title], customField[1][title])False: This will not transform the form fields name eg: title, title

  • controls: Auto add controls (add and delete fields)

The result

Last updated