Created
May 5, 2023 16:58
-
-
Save coulterpeterson/f3e6f7df96271c4193fdee60fa7e0a2b to your computer and use it in GitHub Desktop.
Require User to Autofill At Least Once | Gravity Wiz Address Autocomplete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gravity Wiz // Gravity Forms Address Autocomplete // Require User to Autofill At Least Once | |
* https://gravitywiz.com/documentation/gravity-forms-address-autocomplete/ | |
* | |
* Hides a required field you add to your form, and fills it with a value only if the user successfully autofills | |
* in the form at least once. | |
* | |
* Instructions: | |
* | |
* 1. Install this snippet with our free Custom JavaScript plugin. | |
* https://gravitywiz.com/gravity-forms-custom-javascript/ | |
* | |
* 2. Create a required single line text field in your form, and note its ID. | |
* | |
* | |
* 3. Replace the 4s in the snippet below with your field ID. | |
*/ | |
document.querySelector('#field_GFFORMID_4').style.display = "none"; | |
gform.addAction( 'gpaa_fields_filled', () => { | |
document.querySelector('input[name="input_4"]').value = "true"; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment