C
CES
All,
I'm having a problem returning focus back to an input field in Netscape. The
code works in IE and Opera but not in netscape6+.
Basically I have a function that is called upon exiting a form field, if the
value validates properly it returns true and calls another function, if it
doesn't validate the field it returns false and I want to give focus back to
the sender and highlight all of the text in the field.
The problem is that while IE and opera return the curser back to the field -
Netscape ignores the focus statement (I still can't find any examples as to
how to return the curser and highlight the text in the field).
Any suggestions as to what I'm doing wrong will be appreciated.
CES
function fExitField(sender){
returnedValue = fValidateData(sender);
if(returnedValue == true){ //
fRemoveAsterisk(sender);
}
if(returnedValue == false){
document.forms[fGetFormName(sender)].elements['id_'
+ sender].focus(); // FYI I have multiple forms an the page -
fGetFormName(sender) returns the name of the form that contains the element.
alert("Improper Format");
}
}
This is an example of my tag structure:
<input id="id_cName" name="cName" type="text" maxlength="50"
onFocus="fEnterField('cName')" onKeyDown="fKeyPress('cName')"
onKeyUp="fKeyPress('cName')" onBlur="fExitField('cName')" tabindex="1" />
I'm having a problem returning focus back to an input field in Netscape. The
code works in IE and Opera but not in netscape6+.
Basically I have a function that is called upon exiting a form field, if the
value validates properly it returns true and calls another function, if it
doesn't validate the field it returns false and I want to give focus back to
the sender and highlight all of the text in the field.
The problem is that while IE and opera return the curser back to the field -
Netscape ignores the focus statement (I still can't find any examples as to
how to return the curser and highlight the text in the field).
Any suggestions as to what I'm doing wrong will be appreciated.
CES
function fExitField(sender){
returnedValue = fValidateData(sender);
if(returnedValue == true){ //
fRemoveAsterisk(sender);
}
if(returnedValue == false){
document.forms[fGetFormName(sender)].elements['id_'
+ sender].focus(); // FYI I have multiple forms an the page -
fGetFormName(sender) returns the name of the form that contains the element.
alert("Improper Format");
}
}
This is an example of my tag structure:
<input id="id_cName" name="cName" type="text" maxlength="50"
onFocus="fEnterField('cName')" onKeyDown="fKeyPress('cName')"
onKeyUp="fKeyPress('cName')" onBlur="fExitField('cName')" tabindex="1" />