formUI: UI part of the form module (edit dialog) for editing the data...

Description Usage Arguments See Also Examples

View source: R/formUI.R

Description

UI part of the form module (edit dialog) for editing the data of the crudTableServer

Usage

1
2
3
4
5
6
7
8
formUI(
  id,
  ...,
  newTitle = "New",
  editTitle = "Edit",
  submitLabel = "Submit",
  cancelLabel = "Cancel"
)

Arguments

id

Shiny module identifier of the edit dialog as set by the crudTableServer. (The id is based on the crudTableServer's namespace and ends either with "newForm" or "editForm" accordingly to whether the dialog is used for new data input or existing data update.)

...

The definition of the form, i.e. the shiny input elements whose IDs must be named after the attribute names, as expected by the DAO (see dataFrameDao or sqlDao for more information on Data Access Objects). IDs must also be namespaced, as need by the UI modules, see the example below.

newTitle

A form title used for new data input

editTitle

A form title used for existing data update

submitLabel

Label of the submit button

cancelLabel

Label of the cancel button

See Also

formServerFactory, crudTableServer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# A typical use of the formUI - create an edit dialog for the crudTable:
myFormUI <- function(id) {
   # create namespace - note the use of ns() below in *Input calls
   ns <- NS(id)
   formUI(id,
          selectInput(ns('Plant'), 'Plant', choices = levels(CO2$Plant)),
          selectInput(ns('Type'), 'Type', choices = levels(CO2$Type)),
          selectInput(ns('Treatment'), 'Treatment', choices = levels(CO2$Treatment)),
          numericInput(ns('conc'), 'Ambient CO2 concentration [ml/L]',
                       value = 100, min = 50, max = 1000),
          numericInput(ns('uptake'), 'CO2 uptake rates [umol/m2 sec]',
                       value = 0, min = 0, max = 100)
   )
}

## End(Not run)

beerda/crudtable documentation built on July 13, 2020, 2:16 p.m.