Skip to content

monster.ui.disableAutoFill()#

Syntax#

monster.ui.disableAutoFill($target[, options]);

Parameters#

Key Description Type Default Required
$target Form element containing the fields to temporarily obfuscate. jQuery true
options Lets you override default options (jquery.disableAutoFill). Object false

Errors#

  • "$target" is not a jQuery object: $target is not a jQuery element
  • "options" is not a plain object: options is defined but not a plain object

Description#

The monster.ui.disableAutoFill() method temporarily obfuscates form fields name attributes to disable browsers/password managers auto filling of username/password input elements.

Field names get automatically deobfuscated on form submit or when the options.submitButton is clicked.

Examples#

Get form data on submit#

<form id="my_form">
  <input type="text" name="username" placeholder="Username">
  <input type="password" name="password" placeholder="Password">
</form>
var $template = $(appContent.getTemplate({
    name: 'myForm'
  })),
  $form = $template.find('#my_form');

monster.ui.disableAutoFill($form);

$form
  .on('submit', function() {
    var formData = monster.ui.getFormData('my_form');

    // formData -> { username: '', password: '' }
  });