formSchema: Create a form schema object

View source: R/forms.R

formSchemaR Documentation

Create a form schema object

Description

Generates a new form schema object which can be used to add a new form to ActivityInfo with an optional folder specified or in the case of a new sub- form with a parent form specified.

Usage

formSchema(
  databaseId,
  label,
  id = cuid(),
  elements = list(),
  parentFormId = NULL,
  folderId = NULL
)

Arguments

databaseId

The identifier of the database containing the form

label

The label of the form

id

The identifier of the form; if unused will generate a new cuid

elements

The elements/form fields of the form

parentFormId

The identifier of the parent form of the new sub-form.

folderId

The identifier of the folder containing the new form.

Examples

survey <- formSchema(
   databaseId = "cyx12345gh",
   label = "ActivityInfo form generated from R",
   elements = list(
     textFieldSchema(label = "What is your name?", code = "name", required = TRUE),
     dateFieldSchema(label = "When were you born?", code = "dob")))
## Not run: 
addForm(survey)

## End(Not run)


bedatadriven/activityinfo-R documentation built on Dec. 21, 2024, 8:23 a.m.