Text Field Cannot Allow Specific Words, Clear When Incorrect
I have a text field ("Weeks") that I do not want to allow users to input 'Points', 'Pts', or 'pts' and I want it to clear the text when it falls into these parameters.
I borrowed another code that I used to ensure a number was always negative and it worked - cleared the field when the word was input and everything:
event.rc = (event.value != "Points");
event.rc = true;
if (event.value == "Points") {
app.alert("This field must be a week number or Float");
event.rc = false;
}
Then, in my searchings, I tried to incorporate additional statements to make the code work for all three instances:
event.rc = (event.value != "Points" && event.value != "Pts" && event.value != "pts");
event.rc = true;
if (event.value == "Points" && event.value == "Pts" && event.value == "pts")
{
app.alert("This field must be a week number or Float");
event.rc = false;
}
But this did NOT work. Stopped clearing the field, stopped showing the alert...allows the text to be input without any notification that anything is wrong.
I know I'm doing something wrong...or something that can't be done maybe...? But I don't know how to fix it or how to go about finding out how to fix it. Any help would be much appreciated!
