I get your point about moving the logic to an attribute on the form, but I'd prefer to understand what's going on and let the form helper do its stuff but in the right way.
Jeremy BurnsClass Outfit
http://www.classoutfit.com
Jeremy Burns
http://www.classoutfit.com
On 23 Nov 2011, at 11:51, euromark wrote:
I think its the database schema - if you set default NULL or default
NOT NULL
although I always thought of this as not very helpful (since the forms
are usually not 1:1 what the schema defines)
so in 1.3 I hacked the form helper to avoid adding those rules
automatically.
if I want them to, I would add (required=>true) in the form input
options array manually.
In 2.0 I didnt yet figure out how to avoid the required attribute.
but since some browsers (like chrome) do automatically trigger js
validation there are
now other unwanted sideeffects, too. like js validation differing from
the real model validation.
quite annoying.
On 23 Nov., 12:43, Jeremy Burns <jeremybu...@classoutfit.com> wrote:This seems like such a basic question but it often gets me. What isthe logic that determines whether the form helper marks a field asrequired or not? For example, I have a varchar field that can be nulland accepts up to 100 characters. I have set a maxLength validationrule (that also has required => false, just for good measure). In mymind this is not a required field, but the form helper thinks it is.All I want to do is make sure the max limit is not exceeded. Removingthe validation rule removes the required flag from the form. Where canI find the logic and how can I adjust it at 'run time'?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment