gpaa_prevent_browser_autocomplete (JS)

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Allow browser autocomplete for all Address fields using Address Autocomplete
    2. Allow browser autocomplete for a specific field ID in a form

Description

Filter whether browser autocomplete should be prevented. Defaults to true.

Usage

window.gform.filter( 'gpaa_prevent_browser_autocomplete', 'my_custom_function' );

Parameters

  • preventBrowserAutocomplete boolean

    Whether browser autocomplete should be prevented.

  • GP_Address_Autocomplete instance

    Current instance of the class.

  • formId number

    The current form ID.

  • fieldId number

    The current field ID.

Since

This filter is available since Gravity Forms Address Autocomplete 1.2.13.

Examples

Allow browser autocomplete for all Address fields using Address Autocomplete

gform.addFilter('gpaa_prevent_browser_autocomplete', function( preventBrowserAutocomplete, instance, formId, fieldId ) {
	return false;
});

Allow browser autocomplete for a specific field ID in a form

This example should be added using Gravity Forms Custom JavaScript.

gform.addFilter('gpaa_prevent_browser_autocomplete', function( preventBrowserAutocomplete, instance, formId, fieldId ) {
	if ( GFFORMID != formId ) {
		return preventBrowserAutocomplete;
	}
	
	if ( fieldId != 5 ) {
		return preventBrowserAutocomplete;
	}
	
	return false;
});