PluginWfForm_v2
Plugin to render and handle forms.
getSchemaFieldPrimary
Primary key (only one).
setFormItemsDefaultFromDb
widget_render
Widget setup
type: widget
data:
plugin: wf/form_v2
method: render
data:
url: '/p/test/?_time=1'
ajax: true
submit_value: Save
id: frm_test
items:
type_of_issue:
type: varchar
lable: 'Type of issue'
default: null
mandatory: true
option:
'': ''
1: Applikation
2: Database
container_classzzz: row
email:
type: varchar
lable: Email
default: null
mandatory: true
validator:
-
plugin: wf/form
method: validate_email
name:
type: varchar
lable: Name
default: John
important_level:
type: varchar
lable: 'Level of important (1-10)'
mandatory: true
validator:
-
plugin: wf/form
method: validate_numeric
data:
min: 1
max: 10
description:
type: text
lable: Description
default: null
mandatory: true
description_as_html:
type: text
lable: 'Description as HTML (require PluginWysiwygNicedit inlcude widget to be included)'
default: null
html: true
send_copy_of_this:
type: checkbox
lable: 'Send copy of this'
capture:
_buto: 'Set capture params for using the Capture widget.'
plugin: wf/form
method: test_capture
render:
plugin: wf/form
method: test_render
validation_before:
plugin: wf/form
method: test_validation_before
_layout_help: 'Use the layout param to customize your form. Don´t miss to use the include widget if using this.'
_layout:
-
type: div
attribute:
class: row
innerHTML:
-
type: div
attribute:
class: col-md-4
innerHTML: 'item[{"id": "type_of_issue", "type": "div"}]'
Render a form.
Consider to add data in separate yml file because you need to pic it up again when handle posting values. Use widget to handle post request if necessary.
'yml:/theme/wf/buto/form/my_form.yml'
getSchema
Get fields via schema.
getRow
@param type $key @param type $value @param type $default @return type
getLabel
widget_capture
Widget setup
type: widget
data:
plugin: wf/form_v2
method: capture
Capture post from form via ajax. @param type $data
bind
Bind request params to form. @param type $form @return boolean
setDefaultsFromArray
Bind array where keys matching keys in form.
setOptionFromArray
Set option from array. - value: 11 option: 'Blekinge län' - value: 19 option: Dalarna
getOption
Format options to be used in forms. @param Array $array Keys must be value and option. @param Boolena $add_empty If begin with an empty option. @return Array
validate
Validate form. @param type $form @return type
bindAndValidate
Bind and validate form. @param type $form @return type
setErrorField
Set error for a field. @param type $form @param type $field @param type $message @return type
getErrors
Set error. @param type $form @param type $nl @return string
getErrorsAsArray
Get all form errors as array. @param PluginWfArray $form @return Array
validate_email
Validate email. @param type $field @param type $form @param type $data @return type
validate_password
Validate password. @param type $field @param type $form @param type $data @return type
validatePasswordAbcdef09
Validate password. @param type $password @param type $settings @return boolean
validate_equal
Validate equal. @param type $field @param type $form @param type $data @return type
validate_date
Validate date. @param type $field @param type $form @param type $data @return type
isDate
Check if value is a date. @param type $value @return boolean
validate_numeric
Validate numeric. @param type $field @param type $form @param PluginWfArray $data @return type
saveToYml
Save form to yml file. @param PluginWfArray $form @return boolean
runCaptureMethod
Capture method. @param type $plugin @param type $method @param type $form @return type
test_capture
Method to test capture. @return type
schema_capture
widget_include
Widget setup
type: widget
data:
plugin: wf/form_v2
method: include
Include javascript file.
send
Email form data via capture call. Call this as an capture method from form yml data to send multiple emails.
YML
capture:
plugin: 'wf/form_v2'
method: send
data:
phpmailer: 'Phpmailer data...'
email:
- 'me@world.com'
script:
- "location.reload();"
Dependencies
Usage
Request a plugin
If you need a plugin to your website, one could make a request to a developer.