commitKey = 2 not working (Please Help!)
Okay, so I have a dropdown box (SName) and I have a textbox (Sender_Name). This is what I need to do. I need the dropdown box if anything is selected other than other the value of Sender_Name = the value of SName. Otherwise if other is selected from the dropdown then the textbox becomes visible and the value is the default value. However this is where I am having an issue. I need that value to change if the user enters text in (which I have working) but when you enter off the dropdown (SName) the commitKey for enter doesn't seem to be working. Tab and clicking off works correctly but enter is not. Any help is greatly appreciated. Thank you.
This portion of Javascript was put in the onBlur (run javascript) section of my dropdown field (SName):
var Name = this.getField('Sender_Name');
var SN = this.getField('SName');if (((event.commitKey = 1) && (SN.value == "Other")&&(Name.value != Name.defaultValue)) || ((event.commitKey = 2) && (SN.value == "Other")&&(Name.value != Name.defaultValue)) || ((event.commitKey = 3) && (SN.value == "Other")&&(Name.value != Name.defaultValue))){
Name.value = "Please Enter a Sender Name";
}
This portion of Javascript was put in my format javascript for my dropdown field (SName):
var Name = this.getField('Sender_Name');
var SN = this.getField('SName');if (SN.value=="Other") {
Name.display = display.visible;
}
else{
Name.value = SN.value;
Name.display = display.noView;
}
This protion of Javascript was put in the onFocus (run javascript) section of my textbox (Sender_Name):
if(event.target.value=="Please Enter a Sender Name"){
event.target.value ="";
}
This portion of Javascript was put in my format section of my textbox (Sender_Name):
function sname(){
if (!event.willCommit) {
var value = AFMergeChange(event);
if(!value) return;
if(!AFExactMatch(/^[a-zA-Z \ ]{0,38}/, value)) event.rc = false;
}
}
and obviously calling the keystroke in my textbox (Sender_Name):
sname();