Topic
  • 2 replies
  • Latest Post - ‏2012-10-01T18:56:29Z by george.baker
icannotbelieve
icannotbelieve
20 Posts

Pinned topic autocomplete attribute in HATS input field

‏2011-10-10T04:12:26Z |
Hi,

In normal html, there's a feature that we can set the attribute AUTOCOMPLETE to OFF in order to prevent the browser from remembering sensitive information even the autocomplete setting in browser options is enabled.

eg.
< form autocomplete="off"> – for all form fields.
< input autocomplete="off"> – for just one field.

After default rendering in HATS, normal input field will be transformed in the following way.

<HATS:Component type="com.ibm.hats.transform.components.FieldComponent" widget="com.ibm.hats.transform.widgets.FieldWidget" ....../>

Do we have similar feature to set the autocomplete attribute for HATS component? I tried to simply add the autocomplete attribute in the transformed HATS component, but it showed me jsp runtime error.
Thanks.
Updated on 2012-10-01T18:56:29Z at 2012-10-01T18:56:29Z by george.baker
  • tmparker
    tmparker
    518 Posts

    Re: autocomplete attribute in HATS input field

    ‏2011-10-13T19:53:57Z  
    I have tried implementing the autocomplete attribute; however, it only seems to work on some browsers. You are welcome to try it yourself and see if it works for you.

    Here is what I did. In the head of the JSP page I added the following code:
    
    <script> 
    
    if(document.createElement) window.onload = function()
    { HATSForm.setAttribute( 
    "autocomplete", 
    "off" ); 
    }; </script>
    


    If you want to do it for each input field you can get each input element in the form and set the attribute on each one.
  • george.baker
    george.baker
    315 Posts

    Re: autocomplete attribute in HATS input field

    ‏2012-10-01T18:56:29Z  
    • tmparker
    • ‏2011-10-13T19:53:57Z
    I have tried implementing the autocomplete attribute; however, it only seems to work on some browsers. You are welcome to try it yourself and see if it works for you.

    Here is what I did. In the head of the JSP page I added the following code:
    <pre class="jive-pre"> <script> if(document.createElement) window.onload = function() { HATSForm.setAttribute( "autocomplete", "off" ); }; </script> </pre>

    If you want to do it for each input field you can get each input element in the form and set the attribute on each one.
    I have a customer still using WebFacing. Is it possible to add autocomplete to the login page? If so, how? Not many of use remember much about WebFacing. ;)