Onblur and Onclick events executing simulteneously

Discussion of bugs in Mozilla Firefox
Post Reply
imranbagwan.cs
Posts: 3
Joined: January 3rd, 2018, 4:17 am

Onblur and Onclick events executing simulteneously

Post by imranbagwan.cs »

I have hyperlink in a webpage, that calls a javascript function.

i have another .js file that contains validation methods,

when i provide a invalid input as per the criteria, it works for onblur,

when i provide a invalid input and hit hyperlink directly, it is not stopping for onblur to complete.

it goes further and executes.

"It is working in non ESR Mozilla Browser but now in Mozilla ESR".

And, it works for other browsers as expected.
User avatar
therube
Posts: 21714
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: Onblur and Onclick events executing simulteneously

Post by therube »

> working in non ESR

I take it you mean FF 57 & up?

> Mozilla ESR

I take it to mean FF 52?

What does the code look like?
Anything related noted in Error Console?
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
imranbagwan.cs
Posts: 3
Joined: January 3rd, 2018, 4:17 am

Re: Onblur and Onclick events executing simulteneously

Post by imranbagwan.cs »

<html>
<script type="text/javascript">
function save(){
alert("in Save Method..")
window.location.href = "secondPage.html";
}

function isValidFraction(inputObj) {
if(!inputObj.value.match(/^\d+(\.\d+)?$/)){
inputObj.value="";
//inputObj.focus();
alert("Inavlid Float Number");
return false;
}
return true;
}

function isValidInteger(inputObj) {
if(!inputObj.value.match(/^\d+(\.\d+)?$/)){
inputObj.value="";
//inputObj.focus();
alert("Inavlid Integer Number");
return false;
}
return true;
}

</script>


<a href="javascript:save()"> Save </a> <br><br>
<input type="text" id="float_input" placeholder="Float Value" onblur="if(isValidFraction(this)){alert('valid.......');}">
<input type="text" id="int_input" placeholder="Int Value" onblur="if(isValidInteger(this)){alert('valid.......');}">
</html>
Post Reply