Disable autocomplete completely

Disable autocomplete completely

kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

Hello,

I want to disable chrome/browser autofill/autocomplete the form fields with previously saved data.
I understand that it can be done by adding autocomplete="false" tag to form element.
but with datatables editor how do I add that to form element ?

Regards
Kaustubh

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    Hi @kaustubh.agrawal2000 ,

    Yep, as you said, the autocomplete flag is the way to go. See this example, it's disabled autocomplete on the name field, but not on the others,

    Cheers,

    Colin

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    @colin

    isnt there a better way to disable autocomplete for entire form rather than doing it for every field seperately ??

    I think its too tedious to add the attr object fro every field...

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    Yes, you can set a default for the field options:

    $.extend( true, $.fn.dataTable.Editor.Field.defaults, {
      attr: {
        autocomplete: 'off'
      }
    } );
    

    Allan

This discussion has been closed.