Hi All
I have a drop down list that you can either choose to enter your own text or choose from a list. I was trying to write some validation to ensure that it only accepted numbers of a certain length (i.e it was for years e.g 2009). Following on from my previous post I am now thinking that it maybe easier to check the text entry against the list I have already input into the drop down. If the text entry does not equal one in the list then a message is flagged to the user.
Does anyone know how I can do this?
Thanks in advance.
Darren
Views
Replies
Total Likes
Suppose I have a text field called 'name' and a drop-down list called 'stooges', I can do this...
// form1.page1.subform1.name::exit - (JavaScript, client)
var name_ = form1.page1.subform1.name.rawValue;
name_ = name_.toLowerCase();
for (var i=0; i < form1.page1.subform1.stooges.length;i++) {
var list_name = form1.page1.subform1.stooges.getDisplayItem(i);
list_name = list_name.toLowerCase();
if (name_ == list_name) {
xfa.host.messageBox("Sorry. " + form1.page1.subform1.name.rawValue + " is already a Stooge.");
}
}
Steve
Views
Replies
Total Likes
Hi Steve
This is nearly what I was after, but not quite. I have tried to adapt your code but cant get it to work and it keeps throwing up the message box every time I enter something now. I basically want to compare the rawvalue entered into the drop down list by the user with the entries I had put into it. So if the user enters the year '2010' and I have input a list containing the years '1980' to '2009' it will flag up an error. I hope this makes sense.
Thanking you in advance.
Darren
Views
Replies
Total Likes