how to turn off autocomplete using java script for Struts html:text tag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rakeshvthu
    New Member
    • May 2007
    • 27

    #1

    how to turn off autocomplete using java script for Struts html:text tag

    hi all,

    i am using struts for my presentation and i use html:text for my text boxes

    the issue is i want to disable autocomplete option for that i tried in so many different ways but it has not worked..


    can any one give suggestion by writing javascript for that it is very urgent......... ....




    pls thanku
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    sorry ............. what do u mean by autocomplete??? ?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      You can use the non-standard (I think) autocomplete attribute:
      [HTML]<input ... autocomplete=of f>[/HTML]

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        pls ACODER can u tell me what autocomplete means????

        kind regards.
        dmjpro.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          See this link for a quick explanation.

          Comment

          • ashwinigs23
            New Member
            • Oct 2007
            • 1

            #6
            Use the below script to set autocomplete off :-
            [HTML]
            <script type="text/javascript">
            function init() {
            if (!document.getE lementById) return false;
            var f = document.getEle mentById('auto_ off');
            var u = f.elements[0];
            f.setAttribute( "autocomple te", "off");
            u.focus();
            }
            </script>
            <body onload='init()' >
            <form id="auto_off">[/HTML]
            Last edited by acoder; Oct 4 '07, 10:50 AM. Reason: Added code tags

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Welcome to TSDN!

              Thanks for sharing your solution. It's basically the same solution as mine except that yours does use JavaScript.

              Please use code tags when posting code:

              &#91;CODE=javas cript]
              JavaScript code...
              [/CODE]

              Comment

              Working...