Forms


Forms allow you to utilize a simple UI for data entry to your blockchain ledger. It makes using a blockchain ledger even simpler by not having to worry about the structure of data.

When your app is deployed, sample forms will be created for you to use, but you are not limited to just these sample forms. You can create as many forms as you need for your app.

Import

You can export a created form to be used either later or on another app. To import a form, simply click on Import and upload your exported forms file.

Add New

You can utilize the inbuilt form editor to create or edit a form according to your needs.

  • Name: This will be used to identify both the form and the type of records added or modified by the form into World State

  • Form Type: Select the form type that you wish to design the page with. Based on your selection, the form components will be exposed. There are two form types to choose from:

    1. List Builder

    2. Plugin

List Builder

  • Design Form: Drag-and-drop form elements from the panel on the left or rearrange form elements already on the form canvas to change the layout. You can see the preview of the form immediately.

    • For adding nested data, use dot(.) operator in API section of a form element. eg. properties.weight, details.Name, business.address.city, residence.address.city.

    • To prevent form submissions upon certain conditions, set data.preventSubmit = true. This can be used in the JavaScript section of any form element.
      eg. if(data.status!==’Approved’){ data.preventSubmit = true; }

    • Identity (signed-in user) context is available as form.identity.
      eg. if(form.identity.attributes.RoleName!==’Admin’){ data.preventSubmit = true; }

Form Options

Success Message: You may customize the message shown to the app user when the form is successfully submitted.

Failed Message: You may customize the message shown to the app user when the form submission fails.

Submit Button Label: You may customize the label of the form submission button.

Advanced Settings: “Warning: Do not change without Xooa support.”

  • Smart Contract Function Name (fcn): Select the smart contract function for the form submission.
  • Smart Contract Arguments: Map each function argument to form fields. You may use any (or multiple) form element(s) as a value or use the special keyword: FormData to save the entire form.

Key: For XLDB based apps, you must designate a form field that serves as the unique Key for the specific type of records managed by this form. You may use any form element to act as a key, but you can’t change the key once a form is saved. An example of a good form field Key for records type of Vehicle would be VIN because it is guaranteed to be unique. Uniqueness is not required across different forms because form name is always part of the Key as can be visible when observing data entered using the form in World State.

Value: You may use any (or multiple) form element(s) as the value for the key or use the special keyword: FormData to save the entire form.

Plugin

The Plugins form type can be used to set up the data that will be rendered on the app. Currently, there are three plugins to select from.

HTML: You can write HTML text here. The html format entered here will render as a form on the app.

  • Plugin Settings: Content and CSS - enter the html content here and click Save

Drops Inventory: Drop admins can check inventory information like unsold and sold tokens in a drop.

  • Plugin Settings: Form Name - enter the form name and click Save

View Token: This can be used to show token information, customize values and fetch data through API in a plugin. Also, more sections can be added with a customized structure.

  • Plugin Settings: Content and CSS - enter the html content here
  • Button Text: name the button that will be displayed under the token and click Save