gppt_validation_result (JS)
Description
Filter the Soft Validation result.
Usage
gform.addFilter( 'gppt_validation_result', 'my_custom_function' );
Parameters
result boolean
Whether validation passed.
instance GPPageTransitions
The current instance of
GPPageTransitions
.formId number
The current form ID.
Examples
Soft validate GP Limit Checkboxes’s mininum limit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Gravity Perks // GP Limit Checkboxes // Add support for min limit Soft Validation with GP Page Transitions
*
* https://gravitywiz.com/documentation/gravity-forms-limit-checkboxes/
*
* Requires 1.3.12 or newer of GP Limit Checkboxes.
*
* Instructions:
* - Install using https://gravitywiz.com/gravity-forms-code-chest/
*/
window.gform.addFilter('gppt_validation_result', function (result, gppt, formId) {
var message = 'You must select at least {0} options.';
if (formId != GFFORMID) {
return result;
}
var gplc = window.GPLimitCheckboxes && window.GPLimitCheckboxes.instances && window.GPLimitCheckboxes.instances[formId];
if (!gplc) {
return result;
}
var validationMessage = '<div class="gfield_description validation_message">' + message + '</div>';
// Loops through groups and validate the ones where the fields are on the current page.
for (var i = 0; i < gplc.groups.length; i++) {
var group = gplc.groups[i];
var fields = group.fields;
var fieldsVisible = true;
var groupValidationMessage = validationMessage.gformFormat(group.min);
$(gplc.getSelector(group.fields)).each(function () {
var fieldVisible = $(this).is(':visible');
var pageVisible = $(this).closest('.gform_page').is('.swiper-slide-active');
if (!fieldVisible || !pageVisible) {
fieldsVisible = false;
return false;
}
});
if (!fieldsVisible) {
continue;
}
var belowMin = gplc.isGroupBelowMin(group);
var $parent = $(gplc.getSelector(group.fields)).parents('.gfield');
$parent.each(function () {
var $this = $(this);
if (belowMin) {
if (!$(this).hasClass(gppt.validationClass.split(' ')[0])) {
$this.addClass(gppt.validationClass);
$this
.children('.ginput_container')
.after(
groupValidationMessage
);
}
} else {
$this.removeClass(gppt.validationClass);
$this
.children('.ginput_container')
.next()
.remove();
}
});
if (belowMin) {
return false;
}
}
return result;
});
Since
This filter is available since Gravity Forms Page Transitions 1.0.32.
All Connections
All Perks
- GF Address Autocomplete
- GF Advanced Calculations
- GF Advanced Phone Field
- GF Advanced Save & Continue
- GF Advanced Select
- GF Auto List Field
- GF Auto Login
- GF Better User Activation
- GF Blocklist
- GF Bookings
- GF Conditional Logic Dates
- GF Conditional Pricing
- GF Copy Cat
- GF Date Time Calculator
- GF Disable Entry Creation
- GF Easy Passthrough
- GF eCommerce Fields
- GF Email Users
- GF Email Validator
- GF Entry Blocks
- GF Expand Textareas
- GF File Renamer
- GF File Upload Pro
- GF Inventory
- GF Limit Checkboxes
- GF Limit Dates
- GF Limit Submissions
- GF Live Preview
- GF Media Library
- GF Multi-Page Navigation
- GF Nested Forms
- GF Notification Scheduler
- GF Page Transitions
- GF Pay Per Word
- GF Populate Anything
- GF Post Content Merge Tags
- GF Preview Submission
- GF Price Range
- GF QR Code
- GF Randomizer
- GF Read Only
- GF Reload Form
- GF Submit to Access
- GF Terms Of Service
- GF Unique ID
- GF Word Count