Gossamer Forum
Home : Products : DBMan : Installation :

Another character question...

Quote Reply
Another character question...
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.
Quote Reply
Re: Another character question... In reply to
(In the US, "Big" letters are called "upper case" or "capitals." Smile )

Try this

In the valid reg. expr. part of the db_def for the field add

'^[a-z]+$'

I'm not sure if that will work, but you can give it a try.



------------------
JPD





Quote Reply
Re: Another character question... In reply to
Thank you, this works, but I will also check, that the user adds more than 3 characters in the field. I tried this:
Code:
if((length($in{'URLNaam'}) < 3) and (length($in{'URLNaam'}) > 10)) {
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???
Quote Reply
Re: Another character question... In reply to
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.)

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





Quote Reply
Re: Another character question... In reply to
Thanks,
kind of supid...
Quote Reply
Re: Another character question... In reply to
That's okay. Sometimes those basic logic things get forgotten when you're thinking about something else. Now you understand more about the mistakes I make in the code I give! Smile


------------------
JPD