Jump to content

[SOLVED] Recognise Auto fill


fry2010

Recommended Posts

Hi does anyone know how you can recognise whether a user has used autofill on a form?

At the moment when a user fills my form out I can recognise when they type and also copy and paste. But when I do an auto fill i.e. you select the input box then a drop down menu appears showing what you usually put into a box, and when I click it my check_process() doesnt recognise anything has been put in until the user types again.

I am already checking how many characters have been entered and whether it is valid, this is all working, its just when an auto fill has been done. Any ideas?

 

I thought about doing it through an onclick event, but there might be a better way.

Link to comment
Share on other sites

At the moment I have got it working with onmouseover. But the trouble is everytime the user moves the mouse over the form the function is repeatadly called, which may cause things to slow down. Im not sure. Is constantly calling a function to process a bad thing?

The other way of onclick or onfocus etc is that it will only analyse the data once the user has done another event after they already entered the data. I need it to work straight away after the intial event of auto filling.

Mouseover seems to do the trick nicely though..

Link to comment
Share on other sites

Quite sure mouseover is only fired when the cursor is moved from somewhere else onto the element.. how about keyboard navigation though?

 

If you really need it that bad you could let a timer run checking the value every 0.x sec once the field is focussed, and kill the timer onblur. There's also the possibility of adding the attribute autocomplete="off"

It will cause your page not to validate.. but since it's used to 'fight' something added by javascript you might want to add the fix via javascript as well, document.GetElementById( 'id' ).setAttribute( 'autocomplete', 'off' );

Link to comment
Share on other sites

well it appears to be working , I think u r right about it needs to move onto the element from something else. But basically javascript events are not recognised when you click the auto-fill box that comes up, if u know the type I mean. So its going from off the 'document' when you click or hover over the autofill box, then to the 'document' once u click it or click off it, so the mouseover state is recognised everytime an autofill is done.

Thanks for your suggestions aswell, i was considering setting a timeout event.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.