-
Notifications
You must be signed in to change notification settings - Fork 4
Customize Field
Maxim Hüsler edited this page Mar 28, 2022
·
6 revisions
To customize the form, this is what you must know
- The form is plain old HTML
- The input-fields are also just plain HTML
- The validation is plain html5 + PristineJs
- 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
- 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 thename
orid
attribute instead, assuming that it's the same name on the server
The standard setup saves data in the ContentSimple
content-type. To add more fields which the user can submit, you must
- 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
- [add the input field][cust-field] in the HTML template for the form, in any way you want to
- 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.
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.
This is all just HTML - just create your input-field in html as you would, and that's all you need to do.
The JS framework respects the HTML5 attribute required
, so just change this, that's all you need to do.