Help Upload plugin: validation rules

2012-06-30 Thread Matteo Landi
Hi all, is anybody using Jose Gonzalez's upload plugin [1]? I have a couple of open issues regarding its integration inside my web app, but before filing a bug I wanted to be sure I was doing things the right way. I attached a couple of validation rules to my Model's attachment propert

Re: CakePHP should support better validation rules definition

2012-01-11 Thread jeremyharris
It would be cool to see a plugin that did this. Or, feel free to post an RFC ticket on lighthouse. Like Thiago said, it would be great if you also backed it up with code :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions

Re: CakePHP should support better validation rules definition

2012-01-10 Thread Thiago Belem
Talking is cheap, show me the code! :-) -- Thiago Belem, Desenvolvedor WEB Enviado do meu Android Em 11/01/2012 02:40, "datgs" escreveu: > Hi all, > > I think CakePHP should support for better way to define validation > rules. Like Yii::Model::rules() definition. There ar

CakePHP should support better validation rules definition

2012-01-10 Thread datgs
Hi all, I think CakePHP should support for better way to define validation rules. Like Yii::Model::rules() definition. There are many benefits from it: 1/ Shorter rule definition ( we can group the same rule the same definition) 2/ The rules' parameters are easier to be changed. (Someti

Re: Validation rules - what a nightmare...

2011-12-06 Thread Jeremy Burns | Class Outfit
Most developers understand that a user might enter a password incorrectly, so the wrong value is saved and he can't log back in; so they ask them to confirm the password (which is pretty much common practice). The validation is done on the pre-hashed versions so all validation rules run, a

Re: Validation rules - what a nightmare...

2011-12-06 Thread heohni
Hi! I do not work with confirm password fields. Just on a simple save routine, when I want to register a user, I need to check the password fields that's a) not empty and b) within a between range I can't belive that other programmers work different? How do they validate a user register form? Or

Re: Validation rules - what a nightmare...

2011-12-04 Thread bujanga
Your password input is auto-hashed and therefore will never match your rule ('between', 6,15). And yes, I realize that is almost the example given in the book. (http://book.cakephp.org/view/1154/between) On passwords: http://book.cakephp.org/view/1263/password -- Our newest site for the communit

Re: Validation rules - what a nightmare...

2011-12-03 Thread euromark
well, thats another problem, of course. without last=>true if will show the wrong validation message but your empty string will always be hashed as well (using cake1.3) thats why you shouldnt use "password" as field name. I recommend reading: http://www.dereuromark.de/2011/08/25/working-with-pass

Re: Validation rules - what a nightmare...

2011-12-03 Thread heohni
So it should be this way? 'password' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyPassword', 'required' => true, 'allowEmpty' => false, 'last' => true), 'between' => array('rule' => array('between', 6,15), 'message' => 'ToShortPassword', 'last' => t

Re: Validation rules - what a nightmare...

2011-12-03 Thread euromark
you should be using "last"=>true for every subrule http://book.cakephp.org/2.0/en/models/data-validation.html?highlight=last On 3 Dez., 18:16, heohni wrote: > Hi folks! > > Whats wrong here? > var $validate = array( >         'ben_name' => array( >             'required' => array('rule' => 'notE

Validation rules - what a nightmare...

2011-12-03 Thread heohni
Hi folks! Whats wrong here? var $validate = array( 'ben_name' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyName') ), 'username' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail', 'required' => tru

Re: Validation rules

2011-11-23 Thread Jeremy Burns | Class Outfit
Why didn't I think of that? Thanks. Slaps head. Jeremy Burns Class Outfit http://www.classoutfit.com On 23 Nov 2011, at 12:36, rchavik wrote: > On Wednesday, November 23, 2011 6:56:16 PM UTC+7, Jeremy Burns wrote: > Makes no difference - but then why would it? > > I think I have misunderstood

Re: Validation rules

2011-11-23 Thread rchavik
On Wednesday, November 23, 2011 6:56:16 PM UTC+7, Jeremy Burns wrote: > > Makes no difference - but then why would it? > I think I have misunderstood your issue. I've tried again with this: 'first_name' => array( 'maxlength' => array( 'rule' => array('maxleng

Re: Validation rules

2011-11-23 Thread euromark
'last' => true should be the default for 2.0 anyways as I suggested a few months ago in a ticket. (although, as I understand, 2.0 seems to be capable of returning an array of errors instead of a string) I'd love to understand it, as well, as I, too, have the feeling of losing control over the vali

Re: Validation rules

2011-11-23 Thread Jeremy Burns | Class Outfit
Makes no difference - but then why would it? Jeremy Burns Class Outfit http://www.classoutfit.com On 23 Nov 2011, at 11:53, rchavik wrote: > What about adding 'last' => true in the rule ? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out

Re: Validation rules

2011-11-23 Thread Jeremy Burns | Class Outfit
That's what I imagined too, but this example field has a default of NULL yet it is coming through as required. It seems that adding a validation rule (in this case maxLength) trips the form helper up and it's displayed as required. I get your point about moving the logic to an attribute on the f

Re: Validation rules

2011-11-23 Thread rchavik
What about adding 'last' => true in the rule ? -- 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

Re: Validation rules

2011-11-23 Thread euromark
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

Validation rules

2011-11-23 Thread Jeremy Burns
This seems like such a basic question but it often gets me. What is the logic that determines whether the form helper marks a field as required or not? For example, I have a varchar field that can be null and accepts up to 100 characters. I have set a maxLength validation rule (that also has requir

Re: Validation rules question

2011-11-12 Thread euromark
you should always use the full array syntax and also add last=>true to every rule. example: 'email' => array( 'email' => array( 'rule' => array('email', true), 'message' => 'valErrInvalidEmail',

Re: Validation rules question

2011-11-12 Thread heohni
What do you mean? 'ben_email' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail','required'=> true), 'email' => array('rule' => array('email', true), 'message' => 'SyntaxEmail'), 'unique' => array('rule' => 'isUnique', 'message' => 'E

Re: Validation rules question

2011-11-11 Thread Điển vũ
You set 'last'=> true at mistake place . -- 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 cak

Re: Validation rules question

2011-11-11 Thread Điển vũ
> > Use required => true , > 'ben_password' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyPassword','required'=>true) ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions

Validation rules question

2011-11-11 Thread heohni
Hi, var $validate = array( 'ben_name' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyName') ), 'ben_email' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail'), 'email' => array('rule' =>

Re: Core validation rules examples

2011-10-05 Thread Jonathan
On Oct 5, 1:37 pm, Jonathan wrote: > I think I*ll file a bug report - then we hopefully get the answers > from a core developer. Lighthouse came back to life, so this is now reported as ticket #2068 (http://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/2068- validation-treats-rule-nam

Re: Core validation rules examples

2011-10-05 Thread euromark
gt; > maybe you override the method somewhere? > > No, it's a general problem, that the core validation rules, doesn't > work as the examples in the cook book suggests. > > I think I*ll file a bug report - then we hopefully get the answers > from a core developer. >

Re: Core validation rules examples

2011-10-05 Thread Jonathan
On Oct 5, 12:08 pm, euromark wrote: > either way notEmpty should work fine with the current 1.3 versions > maybe you override the method somewhere? No, it's a general problem, that the core validation rules, doesn't work as the examples in the cook book suggests. I think I*ll f

Re: Core validation rules examples

2011-10-05 Thread euromark
your version might work non the less but it is still better to use the full version especially if you might want to add more than this one rule some day. either way notEmpty should work fine with the current 1.3 versions maybe you override the method somewhere? On 5 Okt., 11:12, Jonathan wrote:

Re: Core validation rules examples

2011-10-05 Thread Jonathan
On Oct 4, 5:10 pm, euromark wrote: > to make sure you should use a fullvalidationarray Is that documented anywhere? - Because then the cook book should be corrected. Otherwise I'm still not sure if the bug is in the book or in the code... Regards Jonathan -- Our newest site for the com

Re: Core validation rules examples

2011-10-04 Thread euromark
to make sure you should use a full validation array var $validate = array( 'title' => array( 'myNotEmptyRule' => array( 'rule' => 'notEmpty', ... On 4 Okt., 16:53, Jonathan wrote: > On Oct 4, 11:49 am, Jens Dittrich wrote: > > > Have you checked the bug reports or fix

Re: Core validation rules examples

2011-10-04 Thread Jonathan
On Oct 4, 11:49 am, Jens Dittrich wrote: > Have you checked the bug reports or fixes from version 1.3.6 to 1.3.12? You > are referring to an quite old release, could have been fixed already. I checked the code from the repository, and it didn't seem to have changed. Now I briefly ran through the

Re: Core validation rules examples

2011-10-04 Thread Jens Dittrich
Have you checked the bug reports or fixes from version 1.3.6 to 1.3.12? You are referring to an quite old release, could have been fixed already. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org

Core validation rules examples

2011-10-04 Thread Jonathan
In the cook book there are several examples of core validation rules like: var $validate = array( 'title' => array( 'rule' => 'notEmpty', 'message' => 'This field cannot be left blank' ) ); However this seems to t

Re: custom validation rules - custom message

2011-09-13 Thread Christophe Vandeplas
Thanks Paul On Fri, Sep 9, 2011 at 9:18 AM, WebbedIT wrote: > Google is your friend.  A search for 'cakephp return link in > validation error': > http://www.google.co.uk/search?q=cakephp+return+link+in+validation+error&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a > > To

Re: custom validation rules - custom message

2011-09-09 Thread WebbedIT
Google is your friend. A search for 'cakephp return link in validation error': http://www.google.co.uk/search?q=cakephp+return+link+in+validation+error&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a To me to: http://stackoverflow.com/questions/6972061/using-htmlhelper-on-m

Re: custom validation rules - custom message

2011-09-08 Thread Christophe Vandeplas
On Mon, Sep 5, 2011 at 12:27 PM, WebbedIT wrote: > The return value from the model's custom validation method becomes the > custom message. Thanks Paul, that works indeed. However I'm still facing a minor problem I can't seem to solve. In my error message (the return value) I'd like to give a li

Re: custom validation rules - custom message

2011-09-05 Thread WebbedIT
The return value from the model's custom validation method becomes the custom message. HTH, Paul @phpMagpie On Sep 2, 8:40 pm, Christophe Vandeplas wrote: > Hello, > > I have a model where a field needs a valudation rule to verify if the > value already exists. > The easy way to implement this i

custom validation rules - custom message

2011-09-02 Thread Christophe Vandeplas
Hello, I have a model where a field needs a valudation rule to verify if the value already exists. The easy way to implement this is by using the isUnique validation. However I want to also modify the message the user gets to give him an url to a location where that value/field is already used. S

Re: Internationalizing Validation Rules Messages in 2.0

2011-07-28 Thread Javier
Hey guys, thanks for your inputs! -- 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+

Re: Internationalizing Validation Rules Messages in 2.0

2011-07-25 Thread majna
Extract task now uses Reflection on models to extract validation messages ($validate array) -- 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.

Re: Internationalizing Validation Rules Messages in 2.0

2011-07-24 Thread Dr. Loboto
http://book.cakephp.org/view/1230/Localization-in-CakePHP - last 2 code blocks On Jul 24, 10:58 pm, Javier wrote: > Hi, > > What is the recommended approach to internationalize validation error > messages in 2.0? > > Thanks, > -Javier -- Our newest site for the community: CakePHP Video Tutorial

Re: Internationalizing Validation Rules Messages in 2.0

2011-07-24 Thread euromark
i started a similar discussion in the core group http://groups.google.com/group/cakephp-core/browse_thread/thread/bd6c5ddda2662a8f/9ffcf1ad9422010f#9ffcf1ad9422010f maybe - as this is directly related we could also discuss the i18n part of it? On 24 Jul., 17:58, Javier wrote: > Hi, > > What is

Internationalizing Validation Rules Messages in 2.0

2011-07-24 Thread Javier
Hi, What is the recommended approach to internationalize validation error messages in 2.0? Thanks, -Javier -- 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 re

RE: Validation Rules Help

2010-11-29 Thread Dave Maharaj
can get any farther. Thanks for the input. Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: November-29-10 2:52 PM To: CakePHP Subject: Re: Validation Rules Help This is merely off the top of my head and only for the domain part, not the username or the

Re: Validation Rules Help

2010-11-29 Thread Miles J
This is merely off the top of my head and only for the domain part, not the username or the @. /^([a-zA-Z0-9\-]+)\.([a-zA-Z]{2,3})(\.[a-zA-Z]{2,3})?$/ On Nov 28, 4:17 pm, "Dave Maharaj" wrote: > This one I have been putting off for a while and finally getting around to > trying to solve it. > >

Validation Rules Help

2010-11-28 Thread Dave Maharaj
This one I have been putting off for a while and finally getting around to trying to solve it. Maybe I just do not know enough about international domain extensions but what I need is a domain to match the email. So take me for example m...@davemaharaj.com would match davemaharaj.com easy enou

After upgrade to 1.3.5 validation rules don't seem to work

2010-10-28 Thread Christian
Hi, ich upgraded my project to 1.3.5 and now my validation rules are not working any more. I used the folllowing code with version 1.3.3 and it worked just fine: [code] class User extends AppModel { var $name = 'User'; var $validate = array( 'use

Custom validation rules and saveAll

2010-09-30 Thread Ernesto
hello. i have 2 models Article hasMany Component in my Component model i wrote a custom validation rule that relies on data from Article model. how can i get this data? $this->Article->find doesn't work because that function loads data from the database.. and i need the going-to-be-saved data arr

Re: validation rules

2010-06-11 Thread Dmitry Shevchenko
Thank you for the answers. Could you show me any example please. On Jun 11, 2:02 pm, euromark wrote: > yeah > thats actually one of the downsites of cake's validation rule settings > at least in the default way > > using __construct() you can achieve more dynamically created rules > > On 11 Jun.,

Re: validation rules

2010-06-11 Thread euromark
yeah thats actually one of the downsites of cake's validation rule settings at least in the default way using __construct() you can achieve more dynamically created rules On 11 Jun., 05:35, "Dr. Loboto" wrote: > Of course you get syntax error. Only constants can be used in class > definition. >

Re: validation rules

2010-06-10 Thread Dr. Loboto
Of course you get syntax error. Only constants can be used in class definition. You can overload model constructor and setup $validate there. On Jun 11, 8:22 am, Dmitry Shevchenko wrote: > Hi > Did someone tried to create a array for the "inList" validation and > then use it? > for example >  va

validation rules

2010-06-10 Thread Dmitry Shevchenko
Hi Did someone tried to create a array for the "inList" validation and then use it? for example var $test = array('one_day', 'five_days','never'); var $validate = array( 'ty_id' => array('numeric'), 'date_arr' => array('allowed_data' => array(

Re: How to dynamically create validation rules

2010-03-01 Thread LunarDraco
You could also take a look at this example which shows how to have different validation based on which action was called for the controller. So you can have a validation based on the 'add' action which is completely different from the validation you might use on 'edit' or 'update'. It also shows ho

Re: How to dynamically create validation rules

2010-02-27 Thread WebRenovator
mum_bid} - > {$this->MyModel->maximum_bid}"); > > if ($this->MyModel->save($this->data)) {...} > > > > so the save function still runs the validate and I set the minimum and > maximum bid during the beforeFilter > > > > Hope this helps. > >

RE: How to dynamically create validation rules

2010-02-26 Thread alan
s helps.Alan Original Message Subject: How to dynamically create validation rules From: Kyle Decot Date: Fri, February 26, 2010 11:28 am To: CakePHP I am creating an API for my website and I want to create validation rules for my various methods based on some rows in my

How to dynamically create validation rules

2010-02-26 Thread Kyle Decot
I am creating an API for my website and I want to create validation rules for my various methods based on some rows in my api_arguments table. How should I go about doing this? Thanks for any help. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP

Re: Validation Rules Implementation Sequence

2009-06-10 Thread Miles J
The first rule is the last rule to be validated, and the last rule is the first to be validated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegro

Validation Rules Implementation Sequence

2009-06-10 Thread CMNAJS
Hello geeks.. what about the implementation of validation rules... whether the first defined rule is implemented first or the last is implemented first. In more fields i got the last to be implemented to be first but in few there is no sequence.. Any idea

HABTM checkboxes disappearing after validation rules applied

2009-03-04 Thread foldiman
I have an add User page that has a set of checkboxes representing the User model's HABTM relationship to another model. On form submission, when one of the validation rules gets triggered, all the checkboxes disappear. Has anyone else encountered this problem? To get around it, I d

Re: Multiple validation rules per field

2009-02-17 Thread leo
A favourite of mine was a colleague who wasn't very literate (or hygienic). When he spell checked his docs in Word, if a word wasn't found, he'd add it to the shared dictionary. It wasn't found because he'd spelt it so badly. Anybody else spell checking their work would then have correct spellings

Re: Multiple validation rules per field

2009-02-17 Thread WebbedIT
Another one for you $this->referer(), not cakes fault as it is a widely adopted misspelling for the referring page. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to

Re: Multiple validation rules per field

2009-02-16 Thread leo
That particular misspelling has bugged me for years. It was actually a keyword in a language I used to use. On Feb 16, 5:42 pm, WebbedIT wrote: > Hi Leo, > > It certainly seems to be down to allowEmpty which the book states ... > > "When set to true, an empty field will skip *all* validation on

Re: Multiple validation rules per field

2009-02-16 Thread WebbedIT
Hi Leo, It certainly seems to be down to allowEmpty which the book states ... "When set to true, an empty field will skip *all* validation on the field" Well spotted on the dependency typo, I have relied on spell checkers too much in life and NetBeans does not catch those for me :o) Paul. --~-

Re: Multiple validation rules per field

2009-02-16 Thread leo
I've just looked at some old code and I recall that I had to leave the message string empty for it to work. I didn't have a problem with the position of allowEmpty = true. then in the form, I handles the message like this: echo $form->label('title', __('TITULO_GA_BLOCS',true)); echo $for

Re: Multiple validation rules per field

2009-02-16 Thread WebbedIT
I have a feeling that by assigning allowEmpty = true to my first rule it then skipped all validation when the field was empty ... by moving my second rule to be the first rule I seem to have overcome my problem. What are your thoughts on this? Should allowEmpty on one rule affect all subsequent r

Re: Multiple validation rules per field

2009-02-16 Thread leo
Also, you've misspellt dependency ;) On Feb 16, 4:05 pm, leo wrote: > Just a quick thought without really looking into it: try prepending > the fields with the model name viz: Something.date_operational > > L > > On Feb 16, 4:00 pm, WebbedIT wrote: > > > Hi, > > > Can anyone spot what I am doin

Re: Multiple validation rules per field

2009-02-16 Thread leo
Just a quick thought without really looking into it: try prepending the fields with the model name viz: Something.date_operational L On Feb 16, 4:00 pm, WebbedIT wrote: > Hi, > > Can anyone spot what I am doing wrong?  I have read the book and a few > blog articles on this and think I have ever

Multiple validation rules per field

2009-02-16 Thread WebbedIT
Hi, Can anyone spot what I am doing wrong? I have read the book and a few blog articles on this and think I have everything setup right but can't get validation to apply more than one rule to a field (processes first rule, ignores the rest). Here is my validate declaration for the field in ques

Re: model validation rules order ?

2008-07-07 Thread Dia
'message'       => '3 caracters min.' >                          ), >                  ) >          ); > > On 6 heinä, 19:44, Dia <[EMAIL PROTECTED]> wrote: > > > Hi > > > I noticed a strange beh

Re: model validation rules order ?

2008-07-06 Thread [EMAIL PROTECTED]
'rule' => array('minLength', 3), 'message' => '3 caracters min.' ), ) ); On 6 heinä, 19:44, Dia <[EMAIL PROTECTED]> wrote: > Hi > > I noticed a strange

Re: model validation rules order ?

2008-07-06 Thread Dia
PS: using 1.2 RC2 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For mor

model validation rules order ?

2008-07-06 Thread Dia
Hi I noticed a strange behaviour and wanted to know if it's there's a order on executing validation rules the example : case 1 : var $validate = array( 'word' => array( array(

Re: Issue with allowEmpty and required in multiple validation rules (1.2)

2008-02-03 Thread cisbrh
; > ) > > allowEmpty defaults to false so u don't need to specify it unless u > want to change it. I think allowEmpty and required options are checked > before the rule specification. So if allowEmpty is false and u submit > no data, cake won't check the rule because validation wi

Re: Issue with allowEmpty and required in multiple validation rules (1.2)

2008-02-03 Thread duRqoo
u don't need to specify it unless u want to change it. I think allowEmpty and required options are checked before the rule specification. So if allowEmpty is false and u submit no data, cake won't check the rule because validation will return false anyway. When you are using multiple valid

Issue with allowEmpty and required in multiple validation rules (1.2)

2008-02-03 Thread cisbrh
Hi everybody, first of all thank you for the really good work you've doing on cake. I've used it 2 years ago for a massive application and I had to write my own postgresql layer... The work done since then especially on 1.2 is amazing. Anyway. I am trying to use multiple validation

Dynamic form validation rules?

2008-01-18 Thread R. Rajesh Jeba Anbiah
I'm searching to see if there is any dynamic form validation (dynamically change the validation for a particular form field from admin interface) implemented already. I hope, that is possible with Behavior; but like to know if any such implementation is already done. TIA -- Email: rrjanbiah-at

Re: Validation rules and error messages

2007-10-11 Thread abba bryant
gt; Wayne Fay wrote: >> >> >> >> > Yes, but according to the MVC pattern, what the user sees (like >> >> error >> >> >> > messages) really is supposed to go into the view, not the >> model... >> >> >> >> Are you sa

Re: Validation rules and error messages

2007-10-10 Thread Baz
> > > > >> Wayne Fay wrote: > > > > >> >> > Yes, but according to the MVC pattern, what the user sees (like > > >> error > > >> >> > messages) really is supposed to go into the view, not the > model... > > > > >>

Re: Validation rules and error messages

2007-10-10 Thread stefanb
he MVC pattern, what the user sees (like > >> error > >> >> > messages) really is supposed to go into the view, not the model... > > >> >> Are you saying that a model cannot generate error messages that need > >> >> to be displayed in a

Re: Validation rules and error messages

2007-10-10 Thread abba bryant
> >> > >> > Yes, but according to the MVC pattern, what the user sees (like >> error >> > >> > messages) really is supposed to go into the view, not the model... >> >> > >> Are you saying that a model cannot generate

Re: Validation rules and error messages

2007-10-10 Thread abba bryant
ees (like >> error >> >> > messages) really is supposed to go into the view, not the model... >> >> >> Are you saying that a model cannot generate error messages that need >> >> to be displayed in a view? >> >> > You *can*... But acco

Re: change validation rules on the fly: how?

2007-10-10 Thread cakeFreak
Superb! CakePHP always rocks! Cheers GriGri! Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, se

Re: change validation rules on the fly: how?

2007-10-10 Thread grigri
If you're using 1.2, you can set the 'on' attribute in the validation rule (like 'on' => 'create' to only enforce the rule only on creation). On Oct 10, 4:48 pm, cakeFreak <[EMAIL PROTECTED]> wrote: > Hey guys, > I have a problem ?!?! > > In my user table I have a field password. > > I want it t

change validation rules on the fly: how?

2007-10-10 Thread cakeFreak
Hey guys, I have a problem ?!?! In my user table I have a field password. I want it to be REQUIRED on "add" action, while I want it NOT-REQUIRED on edit actions. Namely if the field is left blank on "edit" it's value doesn't get changed in DB, an no errors are displayed. How can I achieve this

Re: Validation rules and error messages

2007-10-10 Thread Chris Hartjes
On 10/10/07, stefanb <[EMAIL PROTECTED]> wrote: > > So you're saying I should put HTML and javascript code in my model > too. All I need in my view is a variable sent from the model > containing the display code, and echo that out... Nobody is suggesting that at all as far as I can tell. All I'm

Re: Validation rules and error messages

2007-10-10 Thread Dani
t; > >> Are you saying that a model cannot generate error messages that need > > >> to be displayed in a view? > > > > You *can*... But according to MVC principles, you *shouldn't*. > > > > Wayne > > > -- > > View this message in

Re: Validation rules and error messages

2007-10-10 Thread stefanb
MVC pattern, what the user sees (like error > >> > messages) really is supposed to go into the view, not the model... > > >> Are you saying that a model cannot generate error messages that need > >> to be displayed in a view? > > > You *can*... But according

Re: Validation rules and error messages

2007-10-09 Thread abba bryant
ou *shouldn't*. > > Wayne > > > > > -- View this message in context: http://www.nabble.com/Validation-rules-and-error-messages-tf4581362.html#a13127046 Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~-

Re: Validation rules and error messages

2007-10-09 Thread Wayne Fay
> > Yes, but according to the MVC pattern, what the user sees (like error > > messages) really is supposed to go into the view, not the model... > > Are you saying that a model cannot generate error messages that need > to be displayed in a view? You *can*... But according to MVC principles, you

Re: Validation rules and error messages

2007-10-09 Thread Chris Hartjes
On 10/9/07, stefanb <[EMAIL PROTECTED]> wrote: > > Yes, but according to the MVC pattern, what the user sees (like error > messages) really is supposed to go into the view, not the model... Are you saying that a model cannot generate error messages that need to be displayed in a view? -- Chris

Re: Validation rules and error messages

2007-10-09 Thread stefanb
Yes, but according to the MVC pattern, what the user sees (like error messages) really is supposed to go into the view, not the model... On Oct 9, 8:09 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 10/6/07, stefanb <[EMAIL PROTECTED]> wrote: > > > In my view: > > $form->input('name', array(

Re: Validation rules and error messages

2007-10-09 Thread Chris Hartjes
On 10/6/07, stefanb <[EMAIL PROTECTED]> wrote: > In my view: > $form->input('name', array('type' => 'text', 'class' => 'input_text', > 'error' => array('required' => 'Name is required', 'length' => 'This > field can only be 20 characters long'))) > > How can I avoid this? Can I fetch the rule in m

Re: Validation rules and error messages

2007-10-09 Thread stefanb
So, I take it this is not possible in Cake? On Oct 7, 7:46 pm, "R. Rajesh Jeba Anbiah" <[EMAIL PROTECTED]> wrote: > On Oct 6, 11:24 pm, stefanb <[EMAIL PROTECTED]> wrote:> How can I fetch the > validation parameters from my models? > > > > You may check related links > inhttp://groups.goog

Re: Validation rules and error messages

2007-10-07 Thread R. Rajesh Jeba Anbiah
On Oct 6, 11:24 pm, stefanb <[EMAIL PROTECTED]> wrote: > How can I fetch the validation parameters from my models? You may check related links in http://groups.google.com/group/cake-php/web/frequent-discussions -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --

Validation rules and error messages

2007-10-06 Thread stefanb
How can I fetch the validation parameters from my models? Example: I have a field with maxLength set to 20, and I want to display an error message like "This field can only be 20 characters long". Now, if I update the validation rule in my model to allow max 30 chars, I need to update my view as

Re: Multiple Validation Rules Each with a Unique Message

2007-09-19 Thread 1Marc
I found out that this functionality is built into 1.2. Thank you Geoff your articles were very helpful. On Sep 17, 9:09 am, fr3nch13 <[EMAIL PROTECTED]> wrote: > Another way to do it is by triggering a method in your model from your > function, like so: > > Controller > class UsersController ex

Re: Multiple Validation Rules Each with a Unique Message

2007-09-17 Thread fr3nch13
Another way to do it is by triggering a method in your model from your function, like so: Controller data)) { } else { $this->cleanUpFields(); // make sure no one has this email address

Re: Multiple Validation Rules Each with a Unique Message

2007-09-17 Thread Geoff Ford
t; and > "message" => before the message > > Hope this helps > > On Sep 16, 7:00 pm, 1Marc <[EMAIL PROTECTED]> wrote: > > > I'm looking for a good way to add multiple validation rules each with > > its own error message. > > > I&#

Re: Multiple Validation Rules Each with a Unique Message

2007-09-16 Thread francky06l
Just a hint try to add "rule" => before "VALID_NO _EMPTY" and "message" => before the message Hope this helps On Sep 16, 7:00 pm, 1Marc <[EMAIL PROTECTED]> wrote: > I'm looking for a good way to add multiple validation rules each with > its

Multiple Validation Rules Each with a Unique Message

2007-09-16 Thread 1Marc
I'm looking for a good way to add multiple validation rules each with its own error message. I'm looking at doing something like the following in the Module: class User extends AppModel { var $name = 'User'; var $validate = array(

  1   2   >