InputfieldHidden
InputfieldHidden renders an <input type="hidden"> element for carrying values
through a form without displaying them to the user
Use it for submitted state, tokens, IDs, or computed values that should be present in form data but not edited directly.
$f = $modules->get('InputfieldHidden');
$f->name = 'referrer';
$f->value = $input->get('ref');
$form->add($f); Expand all Collapse all API reference
| Property | Type | Description |
|---|---|---|
renderValueAsInput | bool | When true, renderValue() renders the hidden input rather than display text. Default is false. |
initValue | string | Fallback value used when the value attribute is empty. Default is ''. |
render()
Returns the hidden input markup built from the field attributes.
$f = $modules->get('InputfieldHidden');
$f->name = 'token';
$f->value = 'abc123';
echo $f->render(); // <input type="hidden" name="token" value="abc123" /> renderValue()
Returns display-mode markup. By default this uses the parent Inputfield
renderValue() behavior. When renderValueAsInput is true, it renders the
hidden input instead.
$f = $modules->get('InputfieldHidden');
$f->name = 'token';
$f->value = 'abc123';
$f->renderValueAsInput = true;
echo $f->renderValue(); // hidden input markup getAttributes()
Returns the input attributes. If the value attribute is empty and initValue
is non-empty, initValue is used as the rendered value.
$f = $modules->get('InputfieldHidden');
$f->name = 'mode';
$f->initValue = 'edit';
echo $f->render(); // value="edit" - Access this inputfield with
$modules->get('Inputfield.Hidden') collapsedandcolumnWidthare intentionally removed from its configuration screen because a hidden input has no visible wrapper layout.- For shared Inputfield behavior such as attributes,
name,value,showIf, processing, and validation, see the mainInputfieldAPI documentation.
Source file: wire/modules/Inputfield/Inputfield
API reference: methods, properties, hooks
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Inputfield class also inherits all the methods and properties of: Inputfield, WireData and Wire.
Common
Properties
| Name | Return | Summary | |
|---|---|---|---|
| Inputfield | string | Initial populated value if value attribute not separately populated DEFAULT: '' | |
| Inputfield | bool | Render the hidden input, even when in renderValue mode DEFAULT: false |
Additional methods and properties
In addition to the methods and properties above, Inputfield
API reference based on ProcessWire core version 3.0.269