Dabrowski - 7:40 pm on Sep 22, 2008 (gmt 0) Some more info on the way I intend the custom field to work, specify a string, which is code for letters, numbers, or literal characters. Kinda like a very basic regex. *@## *** would be a UK car reg number. Ooo I also missed times off my list, so, added the following types:
Great ideas guys!
What is a "Free text" field? What would be considered invalid free text?
Urrrr, yeah. Dunno why I put that one in. Anyone can write code to do bugger all!
For Numbers, maybe split it into multiple types: Integer, Decimal
Thats a good one, for prices etc...
Both (Letters + Numbers) = Alphanumeric, correct
Not sure, I'm not entirely certain if alpha technically includes any punctuation or not, so I've added an allow field, for spaces, separators (- and / for numbers, - and ' for letters), and punctuation.
What format of phone numbers? US? International? UK?
Should be easy enough to do all, if not exactly, acceptably. So e.g. 01211239876 would translate to 0121 123-9876. 18005551234 would translate to +1 (800) 555-1234. Maybe have a variable to set home country.
where no prerolled validation pattern will do, so I have a basic class for validation with Regex
I'll have to have a think about how that could be implemented.
A universal system should also be capable of "callbacks" - using AJAX to hit up a database, with a DAL that returns true/false. Example: "that username has been taken, please choose another"
Hmm, I think that may be too specific to write generically. That may be better left for your own code, or server side validation.
whether the value gets a trim()
It was always gonna get a trim, can't think of a reason why you'd disable it?
A length filter is useful for checking emptiness of a field
Was gonna use a requirement flag, same thing.
* = a letter
# = a number
@ = either
anything else = itself
Some more info on the way I intend the custom field to work, specify a string, which is code for letters, numbers, or literal characters. Kinda like a very basic regex.
*@## *** would be a UK car reg number.
Ooo I also missed times off my list, so, added the following types: