LyndonOHRC
Programmer
I have a text form input that I want to validate but can't get it to work. I'm getting -1 returned from the indexOf function even when the value is in the list. I'm guessing -1 is what that function returns on a no find.
My input name is dynamic so I am passing its value using the "this" variable.
Thanks
Form code:
Javascript function:
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
My input name is dynamic so I am passing its value using the "this" variable.
Thanks
Form code:
Code:
<input class="SmallForm"
name="txtLic_Type#Trim(ToString(lic.CurrentRow))#"
value="#lic.lic_type#"
size="3"
maxlength="3"
onblur="IsInList(this,'001,007,425,DP,XR,N/A')">
Javascript function:
Code:
function IsInList(FormValue,ValidList){
var FormValueTrimmed=FormValue.replace(/^\s+|\s+$/g, ""); //trim leading and trailing spaces
var i=ValidList.indexOf(FormValueTrimmed);
alert(i);
}
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey