Disable autofill in mail field

Hi. I’ d like to disable browser’s autofill in some fields. The main thing, I want people to manually enter the mail address in the confirmation mail field.

Hey there! You can use the filter found here to disable individual fields autocomplete values. The first example shows how to enable a particular fields autocomplete, but you would just set it to “off” as in the last

Hi. I’ve added this code in functions, but seems not working. where am i wrong? thx

add_filter( 'gform_field_content', function ( $field_content, $field ) {
    if ( $field->type == 'email' ) {
        return str_replace( 'type=', "autocomplete='off' type=", $field_content );
    }
  
    return $field_content;
}, 10, 2 );

Hi Matteo. Can you share a link to the page on your site where we can see the form? We can check to see if the code is being applied and go on from there. Thank you.

Ya that would be helpful Matteo! In testing this is working for me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.