The AppGyver Enterprise Documentation

Welcome to the AppGyver Enterprise Builder Documentation. Information about the different aspects of Enterprise Builder's functions may be found in the guides presented here. More guides and tutorials will be added in the following weeks.

Feel free to suggest edits on any parts of the documentation that feel unclear.

Get Started    

Data Form

Supported Page Types

The Data Form module can only be added on a Details page.

The Data Form module lets you view and edit resource data set up for your application. In almost all cases, you will use it as part of the auto-generated CRUD page group.

It can only be added to the Details page, and will show the fields and data for the record in question.

Properties

The Data Form module has the following properties:

Name

Module tab title, shown if the module is added to the sub tab bar.

Default Empty Fields JSON

This property sets the text that is displayed when the module has no data saved for a field. You might want to override this to something like "No applicant selected" or "This location does not have a phone number", helping your users to make sense of what they're seeing.

The JSON should be a single-level object of key-value pairs, where the key responds to a data field key in the resource at hand.

{"applicant":"No applicant selected", "phone_number":"This applicant doesn't have a phone number"}

Default Placeholders JSON

This property sets the text that is displayed when the form is in edit mode and there is no data in the field. You can use it to guide your users as to what they should type, for example: "Enter order total price" or "Choose country".

The JSON should be a single-level object of key-value pairs, where the key responds to a data field key in the resource at hand.

{"total_price":"Enter order total price", "country":"Choose Country"}

Default Values JSON

This property prefills the form's data fields, and can be used to speed up resource creation.

This property is only available programmatically – see below for details. It also only takes effect if used when opening the Create page of a resource.

The JSON should be a single-level object of key-value pairs, where the key responds to a data field key in the resource at hand.

{"factory_location":"Washington, DC","status":"All good"}

Supersonic API

When programmatically opening a page that contains the Data Entry module, the default JSONs can be passed in, overriding what has been set in the Composer visual editor.

The defaults are passed as properties of the options object of a supersonic.module.layers.push call. The value is given a stringified JSON object, containing the default values in the format described above. The avilable keys are:

  • default-placeholders: default placeholders JSON
  • default-empties: default empty fields jSON
  • default-values: default values JSON

Code Example

defaultValues =
  name: "Angus MacGyver"
  occupation: "freelancer"
  
placeholders =
  salary: "Input employee salary, if applicable"

  
supersonic.module.layers.push "data.Employees.new",
  "default-values": JSON.stringify(defaultValues)
  "default-placeholders": JSON.stringify(placeholders)

Data Form