Search code examples
google-app-maker

Google appmaker how to have a password type input (hidden text)?


I want to have a password input as simple as the HTML regular type="password" input (i.e., <input type="password" id="password_field">). Are there any built in styles (maybe like 'required') that does that? If not how can I have an obfuscated text field?

I was thinking perhaps I could use the HTML widget and add it there but I am not sure how to access the input's value within the HTML widget. I can imagine it can be done with jQuery, but I do not want to use it.


Solution

  • Code inside the onAttach event handler of your TextBox widget:

    widget.getElement().children[1].setAttribute("type", "password");
    widget.getElement().children[1].setAttribute("id", "password_field");