Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger javascript event when using Google auto fill on firefox

I have a form, in which I am disabling the submit button until an user has typed in all the mandatory fields. I was initially using onkeyup to keep a tab on the mandatory fields and enable the button when all the mandatory fields are filled.

But I had users complaining that they filled in the form using AutoFill button on the Google toolbar and the submit button was still disabled.

I fixed this problem in IE by calling the onpropertychange event for each input element and it worked nicely.

But in Firefox, I couldn't find an event which will get triggered when the Google autofill button is clicked.

Help much appreciated.

like image 734
jack Avatar asked Nov 14 '22 14:11

jack


1 Answers

Thanks for your answers. I had to respond quickly to this issue hence I used the 'setTimeOut()' function to check for mandatory fields and enable the submit button.

$().ready(function() {
    CheckRequiredFields();
    timeOutRtn = setTimeout("AutoMonitorMandatoryField()", "3000");
});

function AutoMonitorMandatoryField() {
    if ($("#btnSave").attr("disabled")) {
        CheckRequiredFields();
        timeOutRtn = setTimeout("AutoMonitorMandatoryField()", "3000");
    }
}

crescentfresh - I will look into the DOMAttrModified event and see if I can get it to work for me.Thanks

like image 166
jack Avatar answered Dec 22 '22 11:12

jack