#6469: [PATCH] Model should provide default form validation errors based on
validation rule
----------------------------+-----------------------------------------------
Reporter: mikesmullin | Type: Enhancement
Status: new | Priority: Low
Milestone: 1.3.x.x | Component: Model
Version: 1.2 Final | Severity: Normal
Keywords: | Php_version: n/a
Cake_version: |
----------------------------+-----------------------------------------------
The model already has everything it needs to generate these messages, and
they can still be compatible with localization.
The primary motivation for this new feature is that any error message
other than "This field cannot be left blank" would be an improvement. For
example, when 'rule' === 'phone' there are many of reasons why the value
would not validate and only one of them is because the field was actually
left blank. When a user attempts to provide a value such as '123-456-7890'
this does not validate, but they are told it is because they left it
blank. This is highly confusing--even deceptive, because in fact the value
is not blank and there is no other helpful advice offered by the system to
clue them in as to why it is invalid.
Drupal FAPI does this to a small degree, but here in my patch (see
attached) I have taken it a step further since CakePHP core defines at
least 26 form validation rules, which empowers us to be much more specific
as to why a field would not be validating.
In my examples you'll see I deliberately opted to be terse in my improved
messages, but bear in mind these could be as specific as we want them to
be. The more specific the better, probably, but I avoided that because of
the way CakePHP FormHelper renders the error messages at this time.
Appending them to the field is not my preference; I am used to Drupal
outputting these at the top of the page, which allows me much more space
to explain what is wrong with each field. But that can be another ticket.
Hope this helps!
--
Ticket URL: <https://trac.cakephp.org/ticket/6469>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---