renderFormControl()
Overview
public string function renderFormControl(
required string name
, required string type
, string context
, string id
, string label = ""
, string savedValue = ""
, string defaultValue = ""
, string help = ""
, struct savedData
, string savedDataField = ""
, string error = ""
, boolean required = false
, string layout = "formcontrols.layouts.field"
)
Renders an individual form control. If in doubt, you should use renderForm
instead of rendering individual form controls.
Arguments
Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the field to use |
type | string | Yes | The control type, e.g. 'richeditor' |
context | string | No | The context |
id | string | No | The HTML ID to use for the rendered form control |
label | string | No (default="") | The label for the control. Can be an i18n resource URI. |
savedValue | string | No (default="") | |
defaultValue | string | No (default="") | The default value to prepopulate the control with (e.g. a saved value from the database) |
help | string | No (default="") | Help text to accompany the control. Can be an i18n resource URI. |
savedData | struct | No | Structure of saved data for the entire form that is being rendered. |
savedDataField | string | No (default="") | If specified, the form control's defaultValue will be sourced from this alternate field in savedData |
error | string | No (default="") | Error string to display with the control |
required | boolean | No (default=false) | Whether or not the form field is required |
layout | string | No (default="formcontrols.layouts.field") | Viewlet to use to render the field's layout |