JavaScript Not Equal: What is the proper syntax for calling a function that isn't equal to custom text?
I'm creating a form that lists employee names and using a document level function that calls an variable array in a custom keystroke script in a combobox.
The end goal is to auto populate the employee's supervisor if the event will commit. Both are comboboxes and both are set to allow the user to enter custom text. I wanted to provision for new hires whose name may not be in the combobox yet.
The code works and I've been using it for years, however I want to create a condition that states if the event value does not equal the function, it resets the supervisor combobox. I wanted to do this in the event the employee looks for their name but can't find it and it ends up populating with someone else's name.
How would I go about this? If I take out lines 7-9 of the custom keystroke script, the script works except for the condition in which custom text is entered.
Document Level Function:
//I left out the variables but below is a one line example of it.
var getSupervisor = {"Employee Name":{ supervisor: "Supervisor Name"}};
function supV(svName) {
this.getField("supervisor").value = getSupervisor[svName].supervisor;
}
Custom Keystroke Script:
//I tried this code with both the not equal (!=) and not equal value or type (!==) operators as well as leaving "event.value" out of calling the function and neither worked.
if( event.willCommit ) {
if(event.value == " ") {
this.resetForm(this.getField("supervisor"));
}
else if(event.value !== supV(event.value)) {
this.resetForm(this.getField("supervisor"));
}
else {
supV(event.value);
}
}
