Articles tagged with validation
Ajax Validation Component
This component adds a few validation options to the already wonderful CakePHP form validation. These features include:
Confirm - Checks two or more fields to make sure they are an exact match (designed for password creation).
Unique - Checks to make sure that a field is not already present in the database (ie email, username, etc).
More output options - There are three output options - unordered list in a div tag of your choice, a JavaScript alert, or just the array to do what you want with it.
Error Class - It has the option to change the CSS class of the label tags for the invalid fields.
The component uses Ajax to be able to validate without refreshing the page. It also relies heavily on the "Standard" CakePHP naming conventions for easier integration.
[Read more] Confirm - Checks two or more fields to make sure they are an exact match (designed for password creation).
Unique - Checks to make sure that a field is not already present in the database (ie email, username, etc).
More output options - There are three output options - unordered list in a div tag of your choice, a JavaScript alert, or just the array to do what you want with it.
Error Class - It has the option to change the CSS class of the label tags for the invalid fields.
The component uses Ajax to be able to validate without refreshing the page. It also relies heavily on the "Standard" CakePHP naming conventions for easier integration.
Validation in another controller
You have 2 controllers, posts and comments, you want to be able to have a form on a posts view which submits to the comments controller, which does its thing then redirect to referrer - easy! BUT you also want the validation errors (if any) to display on the posts view - but currently they get lost when your redirect. Heres how to get around it!
[Read more] Getting Tidy.
5 minutes job to get a fair markup validation implant.
[Read more] More Improved Advanced Validation
Here's a way to perform a cleaner and better way of validating your model data in CakePHP.
[Read more] Rails-like Data Validation
Validate your data like in rails: http://rails.rubyonrails.com/classes/ActiveRecord/Validations/ClassMethods.html
[Read more] Improved Advance Validation with Parameters
This code allows you to perform complex validation on your Model data using both regular expressions and functions as well as supporting multiple validation routines per model field.
[Read more] Multiple rules of validation per field in CakePHP 1.2
There are many great improvements coming with CakePHP 1.2. On this article we'll take a look at multiple rules of validation per field, and how easy it is to use them on our 1.2 models.
[Read more] Captcha component with PhpCaptcha
PhpCaptcha is a library for generating visual and audio CAPTCHAs (completely automated public Turing test to tell computers and humans apart).
[Read more] ConditionalValidation behavior
[Update]: as suggested few modifications :
- model method can be set in the condition
- syntax for fields in the condition can be 'Model.field' or "Model.field" (see example)
- usage of the beforeValidate callback
- "restore" parameter is now part of the settings
Suggestions and comments are welcome.
The validations in cake 1.2 are great, but sometimes I needed to have conditional validation. Because the validations are set at model level, i did implement a behavior that allows to turn on or off validation. I decided to share this on Bakery.
Do not hesitate to comment, I am not sure I have handle this in the correct way.
[Read more] - model method can be set in the condition
- syntax for fields in the condition can be 'Model.field' or "Model.field" (see example)
- usage of the beforeValidate callback
- "restore" parameter is now part of the settings
Suggestions and comments are welcome.
The validations in cake 1.2 are great, but sometimes I needed to have conditional validation. Because the validations are set at model level, i did implement a behavior that allows to turn on or off validation. I decided to share this on Bakery.
Do not hesitate to comment, I am not sure I have handle this in the correct way.
Using Custom Validation Rules To Compare Two Form Fields
Want to make sure that two submitted form fields have the same value? Use the ability to write your own validation rules, to add this validation to your model.
[Read more] Automagic JavaScript Validation Helper
This helper takes your model validation rules and converts them to JavaScript so they can be applied in the client's browser before submitting to the server.
[Read more]
Latest Comments