PtcForms __construct(
[array
$options = null]
)
|
|
Set form method(POST,GET) and start the engine to keep sent values
Parameters:
API Tags:
Information Tags:
void addField(
string
$type, string
$fieldName
)
|
|
Add input field to the object
Parameters:
string |
$type: |
the field type, view class manual for possible values |
string |
$fieldName: |
name for the input field |
API Tags:
Information Tags:
void addFieldAttributes(
string
$fieldName, array|string
$options
)
|
|
Add attributes to input field
Parameters:
string |
$fieldName: |
the name of the input field |
array|string |
$options: |
attributes to add("class","id","style") |
API Tags:
void addFieldEvent(
$fieldName,
$options
)
|
|
Alias of addFieldEvents()
Parameters:
API Tags:
void addFieldEvents(
string
$fieldName, array
$options
)
|
|
Add events to input field
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$options: |
events to add to the input field |
API Tags:
void addFieldLabel(
string
$fieldName, string
$label
)
|
|
Add a label text for the input field
Parameters:
string |
$fieldName: |
the name of the field |
string |
$label: |
the label text for the input field |
API Tags:
Information Tags:
void addFieldValidator(
string
$fieldName, array|string
$options
)
|
|
Add validator for input field
Parameters:
string |
$fieldName: |
the name of the input field |
array|string |
$options: |
add validator("required","email") |
API Tags:
void addFieldValue(
$fieldName,
$options
)
|
|
Alias of addFieldValues()
Parameters:
API Tags:
void addFieldValues(
string
$fieldName, array|string
$options
)
|
|
Add values to input fields
Parameters:
string |
$fieldName: |
the name of the input field |
array|string |
$options: |
value/s to add |
API Tags:
void addLabelOptions(
string
$fieldName, array
$options
)
|
|
Add attributes to the label
Parameters:
string |
$fieldName: |
the name of the field |
array |
$options: |
attributes to add to the label("id","class","style") |
API Tags:
void addValuesParams(
string
$fieldName,
$type, array
$options
)
|
|
Add paramaters to field values group
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$options: |
value/s to add |
|
$type: |
|
API Tags:
void customElAttributes(
$attributes, array
$templates
)
|
|
Manipulate/Add html elements attributes
Parameters:
array |
$templates: |
array of html templates |
|
$attributes: |
|
API Tags:
void customTpl(
$templates
)
|
|
Alias of customTpls()
Parameters:
API Tags:
void customTpls(
array
$templates
)
|
|
Manipulate html templates
Parameters:
array |
$templates: |
array of html templates |
API Tags:
void fieldParentEl(
string
$fieldName, array|string
$options
)
|
|
Add attributes to div container for input field
Parameters:
string |
$fieldName: |
the name of the input field |
array|string |
$options: |
attributes to add, view manual for possible values |
API Tags:
void removeField(
string
$fieldName
)
|
|
Remove field(under development)
Parameters:
string |
$fieldName: |
the name of the field |
API Tags:
void renderField(
string
$fieldName
)
|
|
Render field
Parameters:
string |
$fieldName: |
the name of the input field |
API Tags:
Deprecated: | deprecated since version 8.0.b |
Access: | public |
void renderForm(
[array
$attributes = array()], [array
$events = array()]
)
|
|
Render form
Parameters:
array |
$attributes: |
add form attributes |
array |
$events: |
add form events |
API Tags:
void validateEmail(
string
$fieldName, array
$array
)
|
|
Check if value is valid email
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$array: |
array of values to check |
API Tags:
void validateEqualTo(
string
$fieldName, string
$matchField, array
$array
)
|
|
Check if value matches other field value
Parameters:
string |
$fieldName: |
the name of the input field |
string |
$matchField: |
the name of the input field to match |
array |
$array: |
array of values to check |
API Tags:
Validate form fields defined with the addFieldValidator() method
API Tags:
Return: | fields to validate, an array with isValid(bool) and errors(array) as array keys |
Access: | public |
Information Tags:
void validateNumber(
string
$fieldName, array
$array
)
|
|
Check if value is numeric
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$array: |
array of values to check |
API Tags:
void validatePattern(
string
$fieldName, string
$pattern, array
$array
)
|
|
Check if given regex pattern is matched
Parameters:
string |
$fieldName: |
the name of the input field |
string |
$pattern: |
the pattern to match(regex) |
array |
$array: |
array of values to check |
API Tags:
void validateRequired(
string
$fieldName, array
$array
)
|
|
Check if value is empty
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$array: |
array of values to check |
API Tags:
Alias of validateForm()
API Tags:
Deprecated: | deprecated since version 5.0 |
Access: | public |
void _addClassValidator(
string
$fieldName, array|string
$options
)
|
|
Add validator classes to field for js validation
Parameters:
string |
$fieldName: |
the name of the field |
array|string |
$options: |
the options to pass("required","email") |
API Tags:
void _addCompositeField(
string
$fieldName, array
$values
)
|
|
Add composite for multiple layouts with html table
Parameters:
string |
$fieldName: |
the name of the input field |
array |
$values: |
add previously configured fields to a table layout |
API Tags:
void _addDefaultValues(
string
$array
)
|
|
Add empty default values when addField() is called
Parameters:
API Tags:
void _addFieldParams(
string
$fieldName, array
$type, array|string
$options
)
|
|
Add parameters to field
Parameters:
string |
$fieldName: |
the name of the field |
array |
$type: |
("events","attributes","validate","label","labelOptions","parentEl","value") |
array|string |
$options: |
the options to pass,view manual for details |
API Tags:
void _addInputStyle(
string
$fieldName, string
$fieldStyle
)
|
|
Add default style to field to align properly
Parameters:
string |
$fieldName: |
the name of the field |
string |
$fieldStyle: |
the style property |
API Tags:
void _addLabelStyle(
string
$fieldName, string
$labelContainer, string
$style
)
|
|
Add default style to label to align properly
Parameters:
string |
$fieldName: |
the name of the field |
string |
$labelContainer: |
the html template for label element |
string |
$style: |
the style property |
API Tags:
void _addTableStyle(
string
$fieldName, string
$tableStyle
)
|
|
Add default style to table to align properly
Parameters:
string |
$fieldName: |
the name of the field |
string |
$tableStyle: |
the style property |
API Tags:
void _addValidator(
string
$fieldName, array|string
$options
)
|
|
Add validator to input field
Parameters:
string |
$fieldName: |
the name of the field |
array|string |
$options: |
the options to pass("required","email") |
API Tags:
void _buildAttributes(
string
$fieldName, string
$container, string
$arrKey
)
|
|
Build attributes for html elements
Parameters:
string |
$fieldName: |
the name of the field |
string |
$container: |
the html template for container |
string |
$arrKey: |
(events,attributes,validate,label,labelOptions,parentEl) |
API Tags:
void _buildContainer(
string
$fieldName, string
$fieldHtml, [string
$labelHtml = ''], [bool
$switch = false]
)
|
|
Build container for field
Parameters:
string |
$fieldName: |
the name of the input field |
string |
$fieldHtml: |
the html field element |
string |
$labelHtml: |
the html label element |
bool |
$switch: |
reverse html label position with input field(for radio/checkbox) |
API Tags:
void _buildElAttributes(
string
$container
)
|
|
Replace $_elAttributes with template {attributes}
Parameters:
string |
$container: |
the container html element |
API Tags:
void _buildField(
string
$fieldName
)
|
|
Build fields
Parameters:
string |
$fieldName: |
the name of the input field |
API Tags:
void _buildHtml(
string
$fieldName
)
|
|
Build container for field
Parameters:
string |
$fieldName: |
the name of the field |
API Tags:
void _buildLabel(
string
$case, string
$alignLabel, string
$labelWidth, string
$labelHtml
)
|
|
Build label for field
Parameters:
string |
$case: |
(1,2,3) |
string |
$alignLabel: |
("left","top","right","none") |
string |
$labelWidth: |
the width of the label as a percentage |
string |
$labelHtml: |
the html template |
API Tags:
void _buildList(
string
$fieldName
)
|
|
Build html select options
Parameters:
string |
$fieldName: |
the name of the select field |
API Tags:
void _buildTableData(
string
$cols, string
$type, string
$fieldName, array
$data, string
$container
)
|
|
Build dynamic table for multiple layouts
Parameters:
string |
$cols: |
number of columns |
string |
$type: |
the table type(1,2) |
string |
$fieldName: |
the name of the field |
array |
$data: |
the values for the table |
string |
$container: |
the html table template |
API Tags:
void _checkErrors(
$fieldName,
$type, [
$function = null], [
$errType = null]
)
|
|
Check for errors while building or rendering the form
Parameters:
|
$fieldName: |
|
|
$type: |
|
|
$function: |
|
|
$errType: |
|
API Tags:
void _editMethod(
$array
)
|
|
Change values in form method(POST,GET)
Parameters:
API Tags:
void _rebuildValues(
string
$fieldName
)
|
|
Rebuild values for fields if POST or GET
Parameters:
string |
$fieldName: |
the name of the field |
API Tags:
void _switchLabelEl(
string
$fieldName, string
$labelText
)
|
|
Switch between span and label elements according to field type
Parameters:
string |
$fieldName: |
the name of the input field |
string |
$labelText: |
the text for the label |
API Tags:
Retrieve form method(POST,GET)
API Tags: