simple.param {AnalysisPageServer} | R Documentation

## simple.param

### Description

Build a simple AnalysisPageParam

### Usage

    simple.param(name, label = name, description = label, value = "",
      type = "text", advanced = 0, show.if = NULL, display.callback = NULL,
      size = "medium", required = TRUE, persistent = NULL,
      persistent.dependencies = NULL, transformer = NULL)

### Arguments

`name` | Name of form element
`label` | Label for form element (typically rendered to the left of the element)
`description` | Description for form element (typically rendered as roll-over text)
`value` | The default, starting value, for the form (default: "")
`type` | Type of form element. This can be "text", "textarea", "checkbox", "password" or "file"
`advanced` | Integer. 0 means the option is not advanced, and increasing levels indicate the option is for more advanced users. Advanced > 0 should be hidden under default mode.
`show.if` | A list of two elements: `$name`, giving the name of some other param in the set and `$values`, a character vector of values. The parameter under construction should only be shown if the named parameter takes on any of the values in the `$values` vector. Default (NULL) is to always show the parameter under construction.
`display.callback` | NULL, to follow `show.if` logic in deciding when/if to display the element, or a list with the two elements `$uri` and `$dependent`, which follow the same format as the corresponding arguments to `combobox.param` and provide a templated uri and a mapping from template variables to form parameters. The service should return JSON true if the widget is to be shown and false if not. It is allowed to have both a `display.callback` and a `show.if`—both conditions must be met in order to display the element.
`size` | A word giving the size of the element. The interpretation of this size is up to the front-end. Must from a defined set of words, which you can see by calling `known.param.sizes()` (currently no way to change this). Default: medium
`required` | Logical. Is this a required param? Default: TRUE. If set, then the front-end will the front-end user is required to set this parameter before submitting the request. The meaning of "set this parameter" is not entirely clear.
`persistent` | Character or NULL. If non-NULL then it is passed to the front-end. It names a variable in persistent storage that should be used to initialize the value of the parameter. The front end will provide some mechanism to change the persistent value, but until the user does so the param will be initialized from the value in the persistent space.
`persistent.dependencies` | A character vector or NULL (default) specifying the names of other parameters on which this one "depends". It is an error to include the parameter itself (`name`). It is an error to provide this when `persistent` is NULL. When `persistent` is non-NULL, providing `persistent.dependencies` makes this parameter not just "persistent" but "conditionally persistent", which is to say that the persistent value for this parameter is actually a hash lookup based on the the other parameters specified in this vector. A typical example would be a pheno fields parameter which is dependent on the study parameter. The names are taken from the Page namespace, which means that a parameter's `$name` is used when this differs from its `$persistent` slot.
`transformer` | A function with signature `function(value, self)` or `function(value)` which accepts as first argument the JSON-decoded value of the parameter returned from the front end and then performs some sort of transformation. The return value of the function will be ultimately passed to AnalysisPage handler. For example, for a field which is a simple text widget but which is supposed to be numeric you might use `transformer = as.numeric`. But you could also implement more complicated logic here. The reason to put the logic here instead of in the handler is that it makes it easier to re-use the widget in multiple handlers. If you have a complex (nested) parameter then the nested elements' transformations, if any, are applied first, then the parental transformation is applied. Or, NULL (default) to not do any transformation beyond the JSON decoding.

### Details

Build a simple AnalysisPageParam. These include mainly parameters that can be rendered simply as HTML <input> tags.

### Value

An AnalysisPageParam. This is just a list with class name slapped on.

### Author(s)

Brad Friedman

### Examples

      x <- simple.param("xmin", label="X-min", description="Minimum x value", type="text")
      # Please see the "Persistent Parameters" and "Conditionally Persistent Parameters"
      # sections of the Interactive Apps vignette for demonstrations of these functionalities

[Package AnalysisPageServer version 1.16.0 Index]