View Full Version : Can I tell when a browser has filled in autocomplete fields

3 Jun 2012, 3:54 PM
I want to hide the mask on a form only after the browser has filled in a couple auto-complete fields. In this case, the form will be shown when the page loads, although it would be good to have this functionality when I add a form to a panel after the user has done some action (edit preferences for example). I have been using the controller's onLaunch template method for the initial page load, however, this does not seem reliable. It looks like the browser (Chrome/Firefox) will sometimes apply the saved fields prior to the onLaunch function and sometimes they are applied after this function is called by the framework.

4 Jun 2012, 1:58 PM
Can you check the value of the fields using a listener for afterrender?


4 Jun 2012, 9:33 PM
Hi Scott,

I had previously tried using afterrender and that seems somewhat unreliable. From what I can tell, each browser behaves slightly differently but there is some sort of race condition where the afterrender code can be executed before the browser has filled the autocomplete values into the fields.

In my last set of testing, the code works perfectly if I user a setTimeout and call the function a short time (25 msec) after the afterrender function gets invoked. When I place that same function call in the afterrender call, it works about 15% to 20% of the time. My concern is that the 25 msec delay may work on my machine, but I cannot guarantee this to work on less powerful or heavily utilized client machines.