Skip to main content
Ronen-Was-SRpro
Level 5
July 9, 2018
Risolto

Using a password field on a form

  • July 9, 2018
  • 7 risposte
  • 5394 visualizzazioni

Hi all,

A customer wants to have a password field on a form, do you have any suggestions about how to do that?

I'm asking since this is not a native type of form field (the characters should be hidden and sent to the system). I know it's possible by JS, but any specific ideas on how to do that properly?

Thanks,

Ronen

Questo argomento è stato chiuso alle risposte.
Migliore risposta di SanfordWhiteman

MktoForms2.whenReady(function(form) {

   var formEl = form.getFormElem()[0],

       passwordEl = formEl.querySelector("[name='YourPasswordFieldName']");

  

   passwordEl.setAttribute("type","password");

});

Bear in mind a type=password field doesn't do anything but hide characters from the end user (and people snooping over their shoulder). Has nothing to do with database storage.

7 risposte

SanfordWhiteman
Level 10
July 9, 2018

MktoForms2.whenReady(function(form) {

   var formEl = form.getFormElem()[0],

       passwordEl = formEl.querySelector("[name='YourPasswordFieldName']");

  

   passwordEl.setAttribute("type","password");

});

Bear in mind a type=password field doesn't do anything but hide characters from the end user (and people snooping over their shoulder). Has nothing to do with database storage.

Ronen-Was-SRpro
Level 5
July 9, 2018

Thanks SW,

So JS, as I thought,

I wonder how this wasn't dealt before... I will open an idea about this...

Ronen Wasserman
Grégoire_Miche2
Level 10
July 9, 2018

The reason why it has not been dealt with before is because Marketo is not a safe place to store passwords (field values can be openly read by users and extracted from the database with a simple token in an email or a landing page) and Marketo offers no authentication mechanism (comparing the entered password to the stored value in order to grant access to something).

So the capturing a password in a Marketo form is very limited.

-Greg