Form.button ViewHelper <f:form.button>

Creates a button.

Examples

Defaults:

<f:form.button>Send Mail</f:form.button>
Copied!

Output:

<button type="submit" name="" value="">Send Mail</button>
Copied!

Disabled cancel button with some HTML5 attributes:

<f:form.button type="reset" disabled="disabled"
    name="buttonName" value="buttonValue"
    formmethod="post" formnovalidate="formnovalidate"
>
    Cancel
</f:form.button>
Copied!

Output:

<button disabled="disabled" formmethod="post" formnovalidate="formnovalidate" type="reset" name="myForm[buttonName]" value="buttonValue">Cancel</button>
Copied!

Source code

Go to the source code of this ViewHelper: Form\ButtonViewHelper.php (GitHub).

Arguments

The following arguments are available for the form.button ViewHelper:

additionalAttributes

additionalAttributes
Type
array
Additional tag attributes. They will be added directly to the resulting HTML tag.

aria

aria
Type
array
Additional aria-* attributes. They will each be added with a "aria-" prefix.

data

data
Type
array
Additional data-* attributes. They will each be added with a "data-" prefix.

name

name
Type
string
Name of input tag

property

property
Type
string
Name of Object Property. If used in conjunction with <f:form object="...">, the "name" property will be ignored, while "value" can be used to specify a default field value instead of the object property value.

type

type
Type
string
Default
'submit'
Specifies the type of button (e.g. "button", "reset" or "submit")

value

value
Type
mixed
Value of input tag