Name of the special method field when using methods other than GET and POST
actionstring
Form action (default: "")
layoutstring
Form layout ("plain", "table", "bootstrap" or an instance of FormLayout)
prefixmixed
Use custom prefix when generating names and ID
Other
All other options are passed directly to the form as attributes. Use it to specify attributes such as name, class, etc.
Default options
Default options for forms can be set by extending defaultOptions:
class MyForm extends Form {
static protectedfunction defaultOptions(){return['layout'=>'bootstrap',];}};
MyForm::create("example_default_options",function($f){$f->textField('name','My field name');});
Field options
hint string
Description of the field. (default: none)
Other
All other attributes is passed directly to field, allowing custom attributes such as placeholder, title, etc.
Upload field
remove boolean
Adds a removal checkbox (e.g. a user avatar which is set if file is uploaded but retained if nothing is sent and removed if checkbox is checked) (default: false)
current html
HTML to preview the current uploaded data, e.g. <img src="/user/123/avatar.png"/>. (default: none)