Closed
Bug 359247
Opened 19 years ago
Closed 19 years ago
In FF focus is lost.
Categories
(Firefox :: General, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 359245
People
(Reporter: seemes, Unassigned)
Details
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Build Identifier:
This script works fine in IE. If user enter a value, until phone no is in correct format, it holds in the same field.
FF got a bug, so it is not stoping in same field, when user enter a phone no. It looses the focus and user can enter value in diff field without entering correct phone no.
<input type="text" name="frm_ph" onBlur="return formatPhone(this);" />
function formatPhone(obj)
{
var num = obj.value;
if(num == "")
return false;
var fIndex = num.indexOf('-');
var mIndex = num.substring(4,num.length).indexOf('-');
var sIndex = num.substring(4,num.length).lastIndexOf('-');
if(num.indexOf(' ') != -1){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else if(sIndex != mIndex){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else if((fIndex != -1 && fIndex != 3) || (sIndex != -1 && sIndex != 3)){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else if((fIndex != -1 && fIndex == 3) && (sIndex != -1 && sIndex == 3) && num.length != 12){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else if((fIndex != -1 && fIndex == 3) && (sIndex != -1 && sIndex == 3) && num.length == 12){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else if(num.length != 10){
alert("Phone number format ###-###-####");
obj.select();
return false;
}else{
var tmp = num.substring(0,3) + "-" + num.substring(3,6) + "-" + num.substring(6,10);
obj.value = tmp;
return true;
}
}
Reproducible: Always
Comment 1•19 years ago
|
||
bug 359247 is a duplicate of bug 359245
Comment 2•19 years ago
|
||
*** This bug has been marked as a duplicate of 359245 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
This is a bug in FF..right?.
When next event happens, it loose the past event focus and move along with next event.
I mean, in my case i have obj.select();. This is suppose to go and select everything in the input text and stay there till the issue is corrected.
This is working well in IE.
First Case:
But in FF, when u click outside of input text, it display alert message once. After that, it looses control and goes somewhere.
Second Case:
If you click on another input text, from focus one. Control goes to second input text. It looses the previous event and move alone with new event.
Please let me know, is there any fix for this?.
You need to log in
before you can comment on or make changes to this bug.
Description
•