Skip to content

Customize Field

Maxim Hüsler edited this page Mar 28, 2022 · 6 revisions

Overview

To customize the form, this is what you must know

  1. The form is plain old HTML
  2. The input-fields are also just plain HTML
  3. The validation is plain html5 + PristineJs
  4. The (default) save command will pick up all form-fields, put the data in them in a JSON object and send it to the server
  5. To ensure that the text (like "Please help me...") lands in the correct data-field on the DB, each html-node also has an optional item-property attribute, which contains the property-name on the content-item in the DB. If this is missing, it will use the name or id attribute instead, assuming that it's the same name on the server

Steps to Add Another Fields

The standard setup saves data in the ContentSimple content-type. To add more fields which the user can submit, you must

  1. add the new field in the content-type, with the correct data-type (text, number, etc.) - if you have no idea how to do this, best look at this tutorial
  2. [add the input field][cust-field] in the HTML template for the form, in any way you want to
  3. If you want to translate the field-label, use App-Resources (check out how the other fields are done)

If you want to use a special field like a drop-down etc. just do it in HTML - see below.

Creating Another Field in HTML

Basically you can just duplicate an existing block with a field, and update the item-property as well as the id or name attribute, and you're set.

Remember to also create the field in the content-type into which you will store the information.

Creating a Completely Different Field Type in HTML

This is all just HTML - just create your input-field in html as you would, and that's all you need to do.

Changing Required-Validation on a Field

The JS framework respects the HTML5 attribute required, so just change this, that's all you need to do.