This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Mach V3: Autocomplete off


  1. chinuba
    Member

    Hi
    I have my cool forms and I use them in a secure environment.
    However, I want to automatically disable browser autocomplete in the form.

    I have the JS for this:
    <script type="text/javascript">

    window.onload = function() {
    for(var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
    if(document.getElementsByTagName('input').item(i).type == 'text') {
    document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
    };
    };
    };

    <script>

    Question:
    Where do I apply this script so that auto complete is disabled once the form is loaded? Does Machform V3 have this feature automatically?

    Posted 11 years ago #
  2. yuniar

    There is an easier way to do this. You can edit the view.js file which is located under your machform folder.
    Search around line 3 for this code:

    var field_highlight_color = $("form.appnitro").data('highlightcolor');

    right below that code, add this line:

    $("form.appnitro :input").attr("autocomplete","off");

    that should set the autocomplete attribute to off


    MachForm Founder

    Posted 11 years ago #
  3. chinuba
    Member

    Thank.. really helpful

    Posted 11 years ago #

RSS feed for this topic

Reply