Hi I’m trying to dynamically set focus to a form element. Here is what I have.
function isDate(val,format,formField) {
var date=getDateFromFormat(val,format);
if (date==0) {
alert(“this is ” + formField +” has a wrong date”);
//document.CurrentForm.”formField”.focus();
//document.CurrentForm.ItemAddedOnDate.focus();
document.CurrentForm.focus(‘formField’);
return false;
}
else {
alert(“this is a right date”);
return true;
}
}
I’ve tried test it a few ways I know my variable “formField” has the right value because I have added it into the alert and it is displayed fine and I know that my focus works when I hard code the form field name “ItemAddedOnDate”, however I can’t for the life of me get it to work if I put the variable formfield in the focus. Does anyone have anyidea what I’m doing wrong or how I can get this to work.
TIA
Nikki