1

How can I add the 'autocomplete' HTML tag to the Textbox component

asked 2013-09-17 18:45:05 +0800

ecarpenter gravatar image ecarpenter
33 5

updated 2013-09-17 18:46:26 +0800

We would like to give the browser a hint not to save passwords. The recommended way is to the use the autocomplete="off" tag on the input html tag.

Is there a way that one could add / append this option to the html code that is generated by the textbox mold?

Regards Eddie

delete flag offensive retag edit

6 Answers

Sort by ยป oldest newest most voted
0

answered 2013-09-18 02:08:09 +0800

vincentjian gravatar image vincentjian
2245 6

updated 2013-09-18 02:08:38 +0800

Hi,

You can use client attribute as follows:

<zk xmlns:ca="client/attribute">
    <textbox type="password" ca:autocomplete="off" />
</zk>
link publish delete flag offensive edit
0

answered 2013-09-17 19:21:03 +0800

ecarpenter gravatar image ecarpenter
33 5

updated 2013-09-18 12:07:22 +0800

I found the solution to the problem. Add the following code at top your zul file before the zk tag

<?script content="
    zk.afterLoad('zul.inp', function () {
        var _xtextbox = {};
        zk.override(zul.inp.Textbox.prototype, _xtextbox, {
        textAttrs_: function () {
            return _xtextbox.textAttrs_.apply(this, arguments)+' autocomplete=\"off\"';
        }
        });
    });"?>
link publish delete flag offensive edit
0

answered 2014-12-15 15:23:54 +0800

blarouche gravatar image blarouche
1

Hi,

Both solutions don't work with IE11, Chrome and Mozilla. What is the way to restrict the browsers from asking to remember the password? Thanks

link publish delete flag offensive edit
0

answered 2017-06-02 10:39:28 +0800

kombarov55 gravatar image kombarov55
11 2

updated 2017-06-02 10:46:54 +0800

You should do the following:

  1. Change the type of that input from type="password" to type="text" or just erase that attribute.
  2. Put this script in your zul file (first find a way how to select that input by js, in this case that input is the last one in array of elements with <input> tag):

<script> setTimeout(() => getPasswordInputElement().setAttribute('type', 'password'), 1500) </script>

Delay is required, because without that browser would still insert that saved password. Function getPasswordInputElement() searches for a DOM element.

link publish delete flag offensive edit
0

answered 2017-06-09 05:31:19 +0800

Alam gravatar image Alam
1 1

<textbox id="pwdtb" width="300px" type="password" xmlns:w="client" readonly="true"> <attribute w:name="onBlur"> <attribute w:name="onFocus"> </textbox>

link publish delete flag offensive edit
0

answered 2017-06-09 05:46:29 +0800

Alam gravatar image Alam
1 1

just use <textbox id="pwdtb" width="300px" type="password" xmlns:w="client" readonly="true"> <attribute w:name="onBlur"> <attribute w:name="onFocus"> </textbox>

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-09-17 18:45:05 +0800

Seen: 108 times

Last updated: Jun 09 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More