In my previous article I discussed the new constructs for Model::validate. This article follows on from this and is a run down of the new validation methods and rules available.
First up there are a couple of regular expressions defined, which are the same from CakePHP 1.1 and are pretty self explanatory. These are VALID_NOT_EMPTY, VALID_NUMBER, VALID_EMAIL, and VALID_YEAR (between 1000-2999).
Allows only digits and a-z or A-Z.
Checks that a strings length is between a min and max value.
Checks if a field is empty and treats whitespace characters as empty.
array of card types – like all but limited to a subset of cards.
Allows you to use custom regular expressions. Takes the custom regex as the only parameter.
Checks that a number has a decimal point or is scientific notation. Takes the number of decimal places required after the point as the only parameter. If places is null it will check for scientific notation.
Checks for a valid email address. If a parameter of true is passed it will also attempt to verify the host. If the parameter passed is false, or none is passed it behaves the same as VALID_EMAIL.
Checks a string for a minimum length. Length is passed as the only parameter.
Checks a string for a maximum length. Length is passed as the only parameter.
Checks that a string is numbers, optionally grouped into blocks of 3 separated by a space, comma or period, with an optional block of 2 at the end. Can take a parameter of 'right' if you expect the currency symbol at the end, the default is at the start.
Checks for a valid phone format. Takes regex and country as parameters. Currently only supports 'us' country option.
Checks for a valid post code format. Takes regex and country as parameters. Currently only supports 'us', 'uk' and 'ca' country options.
Checks for a valid social security number format. Takes regex and country as parameters. Currently only supports 'us', 'dk' and 'nl' country options.
Calls a userdefined method of the current model passing along any parameters. , the first of which is the method to call. Personally I think this is redundant as you can simply replace userDefined with your method name and it works the same.
There are also some incomplete methods listed below that will be coming soon.
file – checks for a file.
Thank you, very match !!!
this validation accepts url like "test.com" ?
this is not a proper url format…….
Tadalafil the prescription erectile dysfunction (ED) tablet clinically proven to both work fast (in as little as 30 minutes for some men) and work up to 36 hours vaiagra online generic ! For cialis buy uk fast delivery Europe. Save your money – buy cheap levitra pills on line.. Easy to get cheap cialis pills online… Find out more about levitra at the great viagera 50mg site..
Levitra the prescription erectile dysfunction (ED) tablet clinically proven to both work fast (in as little as 30 minutes for some men) and work up to 36 hours cialias single dose . For levitra discount fast delivery Usa.. No prescription required -buy sexual health pill online.. Easy to get ed treatment pills online. Find out more about cheap viagra at the official cialas discount uk site!
Cheap levitra works in much the same way as Sildenafil Citrate, but is much faster, lasting up to 36 hours vaiagra cheap uk .. For levitra sildenafil citrate very fast delivery worldwide… Save your time – buy ed pills now… Fast to get tadalafil pills online. Find out more about cheap cialis at the online cialias order usa site.
Validation in cakephp finally managed to work :).