- Source:
Methods
(static) calculatedfieldsCreateFieldsHelper(form, suffix) → {Object}
Create a fields helper object for use in user-defined calculation functions. Provides get(), raw(), all(), and sum() methods. When suffix is provided, get() and raw() auto-resolve to the same repeater sub.
Parameters:
| Name | Type | Description |
|---|---|---|
form |
Wpcf7cfForm | The form object |
suffix |
String | Repeater suffix (e.g. '__2' or '__1__3'), empty string if not in repeater |
- Source:
Returns:
The fields helper
- Type
- Object
(static) calculatedfieldsEvaluateFormula(formula, form, suffix) → {Number}
Evaluate a formula string by replacing [field-name] references with actual field values. Supports: +, -, *, /, parentheses, and nested field references. When suffix is provided, field references auto-resolve to the same repeater sub.
Parameters:
| Name | Type | Description |
|---|---|---|
formula |
String | The formula string, e.g. "[quantity] * [price] + 10" |
form |
Wpcf7cfForm | The form object |
suffix |
String | Repeater suffix (e.g. '__2'), empty string if not in repeater |
- Source:
Returns:
The calculated result
- Type
- Number
(static) calculatedfieldsGetCalcValue(fieldName, form) → {Number|null}
Get the numeric calc value for a field by reading data-calc-value from DOM elements. Returns the sum of data-calc-value attributes from selected options or checked inputs. Returns null if no data-calc-value attributes are found (field is not a calc_select/radio/checkbox).
Parameters:
| Name | Type | Description |
|---|---|---|
fieldName |
String | The field name (possibly with [] suffix) |
form |
Wpcf7cfForm | The form object |
- Source:
Returns:
- Type
- Number | null
(static) calculatedfieldsSafeMathEval(expr) → {Number}
Safely evaluate a mathematical expression string. Only allows numbers, +, -, *, /, parentheses, and decimal points. Does NOT use eval().
Parameters:
| Name | Type | Description |
|---|---|---|
expr |
String | The mathematical expression |
- Source:
Returns:
The result, or 0 on error
- Type
- Number
(static) multistepMoveToStep($form, step)
Move to step number step, ignoring any validation.
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
step |
* |
- Source:
(static) multistepMoveToStepWithValidation($form, step)
Validate the current step, and move to step number step if validation passes.
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
step |
Number |
- Source:
(static) repeaterAddSub($form, repeaterDataId)
Append a new sub-entry to the repeater with the name repeaterDataId inside the form $form
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
repeaterDataId |
String | data-id attribute of the repeater. Normally this is simply the name of the repeater. However, in case of a nested repeater you need to append the name with the correct suffix. For example |
- Source:
(static) repeaterAddSubAtIndex($form, repeaterDataId, index)
Insert a new sub-entry at the given index of the repeater with the name repeaterDataId inside the form $form
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
repeaterDataId |
String | data-id attribute of the repeater. |
index |
Number | position where to insert the new sub-entry within the repeater |
- Source:
(static) repeaterRemoveSub($form, repeaterDataId, index)
Remove the last sub-entry from the repeater with the data-id attribute of repeaterDataId inside the form $form
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
repeaterDataId |
String | data-id attribute of the repeater. |
index |
Number | position where to insert the new sub-entry within the repeater |
- Source:
(static) repeaterRemoveSubAtIndex($form, repeaterDataId, index)
Remove the sub-entry at the given index of the repeater with the data-id attribute of repeaterDataId inside the form $form
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
repeaterDataId |
String | data-id attribute of the repeater. |
index |
Number | position where to insert the new sub-entry within the repeater |
- Source:
(static) repeaterSetNumberOfSubs($form, repeaterDataId, numberOfSubs)
Set the number of subs for the repeater with the data-id attribute of repeaterDataId inside the form $form.
Subs are either appended to or removed from the end of the repeater.
Parameters:
| Name | Type | Description |
|---|---|---|
$form |
String | JQuery | JQuery object or css-selector representing the form |
repeaterDataId |
String | data-id attribute of the repeater. |
numberOfSubs |
Number | position where to insert the new sub-entry within the repeater |
- Source: