I will protect a field for filling strange characters and 'BIG' letters (I don't know how you call that in the US) the field may only pass validation, as there are small letters and numbers. How can I define especialy validation for that field?? The number of characters (10) I've set in the db_def.
Sep 27, 1999, 3:46 PM
Veteran / Moderator (8669 posts)
Sep 27, 1999, 3:46 PM
Post #2 of 6
Views: 1938
Sep 27, 1999, 10:43 PM
User (473 posts)
Sep 27, 1999, 10:43 PM
Post #3 of 6
Views: 1953
Thank you, this works, but I will also check, that the user adds more than 3 characters in the field. I tried this:
return "Add more than 2 and less than 11 characters in $in{'URLNaam'}";
} in the sub validate_record in the script. This won't work, what can be wrong???
Code:
if((length($in{'URLNaam'}) < 3) and (length($in{'URLNaam'}) > 10)) { return "Add more than 2 and less than 11 characters in $in{'URLNaam'}";
}
Sep 28, 1999, 5:40 AM
Veteran / Moderator (8669 posts)
Sep 28, 1999, 5:40 AM
Post #4 of 6
Views: 1928
You need to use "or" instead of "and." (The length of a string can't be less than 3 and greater than 10 at the same time.)
return "Add more than 2 and less than 11 characters in $in{'URLNaam'}";
}
------------------
JPD
Code:
if ((length($in{'URLNaam'}) < 3) or (length($in{'URLNaam'}) > 10)) { return "Add more than 2 and less than 11 characters in $in{'URLNaam'}";
}
------------------
JPD