Re: Validate a multiple select in cakephp 3.0

2015-02-27 Thread Cake Developer
Hi Jose, for example Form->input('courses', ['type'=>'select', 'multiple'=>true, 'options'=>$courses, 'label'=>false, 'div'=>false, 'autocomplete'=>'off', 'class'=>'form-control']); ?> user may select 1 or many courses. On Friday, February 27, 2015 at 7:12:20 PM UTC+5:30, José Lorenzo wrote:

Re: Validate a multiple select in cakephp 3.0

2015-02-27 Thread José Lorenzo
What field are you trying to validate? On Friday, February 27, 2015 at 2:02:00 PM UTC+1, Cake Developer wrote: > > I see cakephp 3.0 has same multiple select validation but I am getting > error Array to string conversion > > here is what I tried > > ->notEmpty('input_field', __('Please select opt

Re: Validate a multiple select in cakephp 3.0

2015-02-27 Thread Cake Developer
I see cakephp 3.0 has same multiple select validation but I am getting error Array to string conversion here is what I tried ->notEmpty('input_field', __('Please select option(s)')) ->add('input_field', [ 'multiple'=>[ 'rule'=>['multiple', ['min'=>1]], 'message'=>'Please select option' ] ]) O

RE: Validate Dynamic Forms

2014-05-22 Thread Advantage+
s of the fields …… and so on From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Stephen S Sent: Thursday, May 22, 2014 4:56 PM To: cake-php@googlegroups.com Subject: Re: Validate Dynamic Forms You can add and remove validation rules on the fly before you check

Re: Validate Dynamic Forms

2014-05-22 Thread Stephen S
You can add and remove validation rules on the fly before you check if the form is valid. http://book.cakephp.org/2.0/en/models/data-validation.html#dynamically-change-validation-rules On 22 May 2014 19:50, Advantage+ wrote: > I am building a questionnaire where the user can add questions to a

Re: Validate if not between

2013-11-19 Thread Salines
Thanks for your reply, exactly, it is a query that has to be performed during the validation, in order to check the validity of data entry. My mistake, the query must be simple BETWEEN Dana utorak, 19. studenoga 2013. 11:03:06 UTC+1, korisnik Benjamin Chéré napisao je: > > Hello, > I think it'

Re: Validate if not between

2013-11-19 Thread Benjamin Chéré
Hello, I think it's not a validation rule, your query is a search condition $this->Publisher->find ('all', array( 'fields' => array('pub_name', 'country', 'pub_city', 'estd'), 'conditions' => array('OR'=>array('YEAR(estd) <' => 2010, 'YEAR(estd) >' => 2013)) )); Le lundi 18 novembre 2013 23

RE: Validate Question

2013-05-10 Thread Advantage+
Right. My bad. Good looking out! Thanks guys J From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of André Luis Sent: Friday, May 10, 2013 8:53 AM To: cake-php@googlegroups.com Subject: Re: Validate Question It´s not a rule model have no access to components

Re: Validate Question

2013-05-10 Thread André Luis
It´s not a rule model have no access to components, you can get it on any method inside any model using AuthComponent::user('user_id'), that´s why some components have some static method, an example of this is when you create a user and need to hash the password before it saves... on model User

Re: Validate Question

2013-05-10 Thread Chetan Varshney
Create a variable in model for e.g. in User model var $auth; and set this variable value from controller's beforeFilter function $this->User->auth = $this->Session->read('Auth'); now you can access user id in User model this way $userId =0; if(!empty($this->auth['User']['id'])) { $userId =$t

Re: validate select field in a Model

2012-11-01 Thread Chris
thanks chetan,... ! it works ...! no empty spots,... On Thursday, November 1, 2012 10:04:38 AM UTC-7, chetan varshney wrote: > > use like this > > echo $this->Form->input("gender" , array('type' => 'select', > 'options'=>$genders))?> > > good luck all set > > On Thu, Nov 1, 2012 at 10:16 PM, Ch

Re: validate select field in a Model

2012-11-01 Thread Chetan Varshney
use like this echo $this->Form->input("gender" , array('type' => 'select', 'options'=>$genders))?> good luck all set On Thu, Nov 1, 2012 at 10:16 PM, Chris wrote: > thanks chetan,... I have tried that too,... no luck,... steel having empty > spots on top of options,... please take a look of i

Re: validate select field in a Model

2012-11-01 Thread Chris
thanks chetan,... I have tried that too,... no luck,... steel having empty spots on top of options,... please take a look of it,... http://www.hamayk.com/signup I have remove 'unknown' On Thursday, November 1, 2012 5:47:04 AM UTC-7, chetan varshney wrote: > > The logic you are trying to use

Re: validate select field in a Model

2012-11-01 Thread Chris
hi jsundquist,... in fact I'm getting an 2 empty spots on top with no options empty,... what if the new user who's trying to signup accidentally deselect it ? ,... and there we need the red wrapping warning with message,... 'message' => 'Gender must be valid',... anyway,... for now I'm validat

Re: validate select field in a Model

2012-11-01 Thread Chetan Varshney
The logic you are trying to use it produce html as- unknown male female So you should use in following way- Configure::write('User.genders', array(''=>'unknown', '1'=>'male', '2'=>'female')); rest code is same On Thu, Nov 1, 2012 at 3:53 PM, Chris wrote: > > hi guys,... I'm using cake 1.3

Re: validate select field in a Model

2012-11-01 Thread Jonathan Sundquist
A select dropdown will never be empty unless one of the options is an empty string. - Jon On Nov 1, 2012 5:23 AM, "Chris" wrote: > > hi guys,... I'm using cake 1.3 > how can I validate "select" field from Model,? > > what I have in bootstrap: > Configure::write('User.genders', array('unknow

Re: validate select field in a Model

2012-11-01 Thread Jonathan Sundquist
- Jon On Nov 1, 2012 5:23 AM, "Chris" wrote: > > hi guys,... I'm using cake 1.3 > how can I validate "select" field from Model,? > > what I have in bootstrap: > Configure::write('User.genders', array('unknown', 'male', 'female')); > > in a view: > > > $genders = array(Configu

Re: validate access to bootstrap-var

2012-01-04 Thread jeremyharris
You'll have to assign the validation rule upon model construction. Use the __construct function on the model to add that specific validation rule and you should be good. -jeremy -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Ques

Re: Validate date from model

2011-10-24 Thread Andrey Puhalevich
var $validate = array( 'end_date' => array( 'comparison' => array('rule'=>array('field_comparison', '>', 'start_date'), 'allowEmpty'=>true), ), ); function field_comparison($check1, $operator, $field2) { foreach($check1 as $key=>$value1) {

Re: Validate from within a model

2011-04-28 Thread Miles J
You can also create the folders and make the writable before hand, that way the file will always upload. On Apr 28, 12:55 pm, cricket wrote: > On Thu, Apr 28, 2011 at 2:17 PM, func0der wrote: > > Can you explain that a bit more precise. > > http://php.net/manual/en/function.is-dir.phphttp://www.

Re: Validate from within a model

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 2:17 PM, func0der wrote: > Can you explain that a bit more precise. http://php.net/manual/en/function.is-dir.php http://www.php.net/manual/en/function.is-writable.php I usually handle uploads on the controller/component side. Save your model record, get the new ID, save t

Re: Validate from within a model

2011-04-28 Thread func0der
Can you explain that a bit more precise. On Apr 28, 7:59 pm, Miles J wrote: > Why don't you just validate that the destination folder exists and is > writable? > > On Apr 28, 2:57 am, func0der wrote: > > > > > > > > > Okay. > > > I'm doing it like this. > > > I'm havin a new file uploaded. > > T

Re: Validate from within a model

2011-04-28 Thread Miles J
Why don't you just validate that the destination folder exists and is writable? On Apr 28, 2:57 am, func0der wrote: > Okay. > > I'm doing it like this. > > I'm havin a new file uploaded. > The file data, like mime type, name etc. will be saved in the db under > the file id. > I'm using that id as

Re: Validate from within a model

2011-04-28 Thread func0der
Okay. I'm doing it like this. I'm havin a new file uploaded. The file data, like mime type, name etc. will be saved in the db under the file id. I'm using that id as a filename for the files in my filesystem. So i need to first create a db record to use the id. Afterwards i'm trying to save the

Re: Validate from within a model

2011-04-28 Thread euromark
but thats awfully wrong and dangerous your primary validation should be in php (in the model) js validation is just a nice little addon On 28 Apr., 04:15, cake-learner wrote: > I always do validation with Jquery plugins not with cakephp function > since the form function is limited. -- Our newe

Re: Validate from within a model

2011-04-27 Thread cake-learner
I always do validation with Jquery plugins not with cakephp function since the form function is limited. -- 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 relate

Re: Validate from within a model

2011-04-27 Thread Miles J
You dont need to use validates(), just set an error manually. $this->invalidate('fields', 'Error message.'); Also, your approach is still wrong IMO. You should be doing all error checking before any save functionality is triggered. In what scenario will the image NOT copy/transfer? I have yet to

Re: Validate from within a model

2011-04-27 Thread func0der
okay...i think i got it. It is part of the MVC pattern, isn't it? The model is NOT connected to the view or the helpers. These two are getting their data or the invalid error messages by the controller. Am i right here? On 27 Apr., 21:00, func0der wrote: > I can re-save and delete, so why i sh

Re: Validate from within a model

2011-04-27 Thread func0der
I can re-save and delete, so why i shouldn't be able to revalidate? The error message is also in the "validationErrors" variable but while the output of the form there is no error message. But why? On 27 Apr., 20:38, Miles J wrote: > You can't validates() something after the model save has alrea

Re: Validate from within a model

2011-04-27 Thread Miles J
You can't validates() something after the model save has already happened. Use a behavior for validation or use my plugin. https://github.com/milesj/cake-uploader And an example model on how to use it. https://github.com/milesj/cake-uploader/blob/master/tests/models/upload.php On Apr 27, 11:18 

RE: Validate HABTM Multiple

2011-04-04 Thread Krissy Masters
, April 05, 2011 2:05 AM To: CakePHP Subject: Re: Validate HABTM Multiple Are you using the 'with' key in the model relationship? Are you doing it in both directions? I don't know if it will help but I vaguely remember something along these lines. On Apr 3, 11:41 am, "Krissy Master

Re: Validate HABTM Multiple

2011-04-04 Thread gremlin
Not some. > > K > > > > > > > > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > Of euromark > Sent: Sunday, April 03, 2011 9:07 AM > To: CakePHP > Subject: Re: Validate HABTM Multiple > >

RE: Validate HABTM Multiple

2011-04-03 Thread Krissy Masters
@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of euromark Sent: Sunday, April 03, 2011 9:07 AM To: CakePHP Subject: Re: Validate HABTM Multiple "but I never get any validation errors for the HABTM model " what does $this->Post->saveAll() return? boolean or array? pr()

Re: Validate HABTM Multiple

2011-04-03 Thread euromark
at is) if it validates. > > Not being an ass but that sounds like saveSome() if your validating it > first.no? > > > > > > > > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > > Of Jeremy Burns |

RE: Validate HABTM Multiple

2011-03-31 Thread Krissy Masters
at is) if it validates. Not being an ass but that sounds like saveSome() if your validating it first.no? -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Jeremy Burns | Class Outfit Sent: Friday, April 01, 2011 12:53 AM To: cake-

Re: Validate HABTM Multiple

2011-03-31 Thread Jeremy Burns | Class Outfit
Couldn't you write a custom validation rule in the Post model that examines the count of the Category key of the data array passed in? Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 1 Apr 2011, at 01:18, Krissy Masters wrote: > How can you validate the numb

Re: validate unique on batch imports

2011-03-27 Thread cricket
On Sun, Mar 27, 2011 at 5:26 PM, Ryan Schmidt wrote: > On Mar 27, 2011, at 10:22, euromark wrote: > >> and it assumes that you actually use "transactions" which which mysql >> and isam i do not :) >> mainly because some databases can't be switched that easily >> so i prefer using a complete app-ba

Re: validate unique on batch imports

2011-03-27 Thread Ryan Schmidt
On Mar 27, 2011, at 10:22, euromark wrote: > and it assumes that you actually use "transactions" which which mysql > and isam i do not :) > mainly because some databases can't be switched that easily > so i prefer using a complete app-based approach Yeah, if you're still using MyISAM I can't help

Re: validate unique on batch imports

2011-03-27 Thread euromark
and it assumes that you actually use "transactions" which which mysql and isam i do not :) mainly because some databases can't be switched that easily so i prefer using a complete app-based approach On 27 Mrz., 04:59, Ryan Schmidt wrote: > On Mar 26, 2011, at 21:45, euromark wrote: > > > On 27 M

Re: validate unique on batch imports

2011-03-26 Thread Ryan Schmidt
On Mar 26, 2011, at 21:45, euromark wrote: > On 27 Mrz., 03:26, Ryan Schmidt wrote: >> If the title is supposed to be unique, put a UNIQUE index on the title >> column in the database. That will prevent duplicates from being inserted. >> Though it won't necessarily help you get a user-friendly er

Re: validate unique on batch imports

2011-03-26 Thread euromark
exactly, ryan thats too late if you want to validate all of em first before starting to insert them into the database @cricket: yeah, that was a relict from the old method of mine - from back in the day when i didnt know about list()^^ On 27 Mrz., 03:26, Ryan Schmidt wrote: > On Mar 26, 2011, a

Re: validate unique on batch imports

2011-03-26 Thread Ryan Schmidt
On Mar 26, 2011, at 18:40, euromark wrote: > I encountered this problem several times with some batch imports or > multiple form boxes saved together. > > You have a validation rule "isUnique" for the title. > If you validate all your - lets say 15 - records, they are OK, even if > two of them h

Re: validate unique on batch imports

2011-03-26 Thread cricket
On Sat, Mar 26, 2011 at 9:00 PM, euromark wrote: > just wrote something myself - although its not tested yet, either: > >        /** >         * @param array $data >         * @param array $options >         * - scope (array of other fields as scope - isUnique dependent on > other fields of the ta

Re: validate unique on batch imports

2011-03-26 Thread euromark
just wrote something myself - although its not tested yet, either: /** * @param array $data * @param array $options * - scope (array of other fields as scope - isUnique dependent on other fields of the table) * - batch (defaults to true, remembers previo

Re: validate unique on batch imports

2011-03-26 Thread cricket
On Sat, Mar 26, 2011 at 7:40 PM, euromark wrote: > I encountered this problem several times with some batch imports or > multiple form boxes saved together. > > You have a validation rule "isUnique" for the title. > If you validate all your - lets say 15 - records, they are OK, even if > two of th

RE: Validate - Version 1.3.7

2011-02-19 Thread Krissy Masters
Try adding: 'required' => false, 'allowEmpty' => false, From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Roger Pitigliani Sent: Saturday, February 19, 2011 1:11 PM To: cake-php@googlegroups.com Subject: Validate - Version 1.3.7 Hi. My validator not workin

Re: Validate from the controller

2011-02-14 Thread Felipe Carballo
Miles J, it's all i want to know. If validates() supports only one array dimension, i can't validate like i did. =/ Thank you folks. On Feb 14, 4:19 pm, Miles J wrote: > I believe you have to use saveAll() in this instance, validates() only > supports 1 array dimension. > > On Feb 14, 9:23 am, D

Re: Validate from the controller

2011-02-14 Thread Miles J
I believe you have to use saveAll() in this instance, validates() only supports 1 array dimension. On Feb 14, 9:23 am, Dee Johnson wrote: > I'm not 100% sure I understand what you are going for here, but if all you > want to do is validate the input THEN save, which is what I gather from your > q

Re: Validate from the controller

2011-02-14 Thread Dee Johnson
I'm not 100% sure I understand what you are going for here, but if all you want to do is validate the input THEN save, which is what I gather from your question (please correct me if I'm wrong) then you need to move your validation code to the model and anything else if you want to do before a

Re: Validate input select

2010-10-07 Thread euromark
required=>true is never a solution in my option :) On 7 Okt., 19:57, and wrote: > I would also suggest to put > > 'required' => true > > in your validation, just to be sure! :-) > > On 7 Okt., 09:16, xamako wrote: > > > > > Hi, > > > I'm trying to validate a select field. > > > 'poblacion_id'=>

Re: Validate input select

2010-10-07 Thread and
I would also suggest to put 'required' => true in your validation, just to be sure! :-) On 7 Okt., 09:16, xamako wrote: > Hi, > > I'm trying to validate a select field. > > 'poblacion_id'=>array( >                                 'rule' => 'notEmpty', >                                 'message'

RE: Validate input select

2010-10-07 Thread Dave Maharaj
You also may want to validate the actual values as a user an easily change the values in the select and put any value they want. -Original Message- From: xamako [mailto:xam...@gmail.com] Sent: October-07-10 5:36 AM To: CakePHP Subject: Re: Validate input select Solved! The error was

Re: Validate input select

2010-10-07 Thread xamako
Solved! The error was in the name of the field. Thanks! On 7 oct, 09:16, xamako wrote: > Hi, > > I'm trying to validate a select field. > > 'poblacion_id'=>array( >                                 'rule' => 'notEmpty', >                                 'message'=>"Debe seleccionar un valor."),

Re: validate field or field

2010-08-03 Thread rez...@gmail.com
many thanx Nabil many thanx Dr.loboto Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googleg

Re: validate field or field

2010-08-03 Thread Dr. Loboto
You can setup normal validation for each of OR fields (with allowEmpty = true) and check validation status for both in beforeSave. Return false if both are invalid or empty and true in other case. On Aug 3, 8:25 pm, "rez...@gmail.com" wrote: > hi > I have a form with three fields and I need to va

Re: validate field or field

2010-08-03 Thread Nabil Alsharif
There is no OR operation when validating fields... I think your two options are to either not require the filed, i.e 'required'=>false as part of your rule or to write a custom validator function to do what you want. On Tue, Aug 3, 2010 at 8:25 AM, rez...@gmail.com wrote: > hi > I have a form wit

Re: Validate against two models from one controller

2010-07-25 Thread Papa_Gateau
Further to my last post - please excuse my noob ignorance, I need to call the validation So I have added the following to my code: $this->Formextra->validates($this->data) and surprise, surprise the validation works. P_G Check out the new CakePHP Questions site http://cakeqs.org and help other

Re: Validate against two models from one controller

2010-07-25 Thread Papa_Gateau
Hi Cricket, Thanks for the response. Yes, we will be upgrading the app but its not scheduled for this round of work (I'm still learning my around cake). WRT to my initial question - thanks again. The reason that I have created a dummy model is to apply validation against those fields. However,

Re: $validate Does not work as expected!

2010-07-23 Thread saidbakr
The form does not contain any hidden fields for "mdate". I just want the controller to be able to supply the model with the mdate value instead of the user input. Hence the mdate value is already empty because there is no any value for it in the form. I think that Cake applying an automated data (d

Re: Validate against two models from one controller

2010-07-23 Thread cricket
On Fri, Jul 23, 2010 at 8:35 AM, Papa_Gateau wrote: > Hi I'm using cake 1.1 and am fairly new to it - I've inherited a > fairly complex application which I have been tasked with updating. First thing: consider upgrading the app immediately, rather than adding even more functionality. You'll have

Re: $validate Does not work as expected!

2010-07-22 Thread LunarDraco
You haven't shown us the structure of $this->data for all we know the mdate field does exist and is an array of datetime format which means its not empty even though the values of each name value pair in the array maybe Empty. Also what does your form create code look like. Do you have a hidden in

Re: $validate Does not work as expected!

2010-07-22 Thread saidbakr
I use 1.2. Already I changed the field name from mdate to created and it works fine now. However, the question is remained and it need to be answered. What could we do if we want more than one or two datetime fields in the table or at least we want to give the datetime fields other names. Is there

Re: $validate Does not work as expected!

2010-07-22 Thread euromark
and if you use cake1.3 check out how the arrays are properly structured (yours are not) On 22 Jul., 03:40, huoxito wrote: > I guess you should use cake convention flelds for this which are > 'created' and 'modified' instead of 'mdate' in your case. > > If you have those fields in your table you w

Re: $validate Does not work as expected!

2010-07-21 Thread huoxito
I guess you should use cake convention flelds for this which are 'created' and 'modified' instead of 'mdate' in your case. If you have those fields in your table you won't have to bother about validating or saving manually that datetime of your records. On 21 jul, 17:37, saidbakr wrote: > Hi, >

Re: Validate only some field

2010-06-08 Thread josu jauregui
Hi marco! I use: $this->myModel->validate = Set::merge($this->myModel->validate, $newValidation); where $newValidation has the new rules to the specific case. for example: $newValidation= array('name_of_the_field_in_the_model_validation' => array('name_of_validation' => array('rule' => VALID_

Re: Validate data & md5

2010-06-07 Thread Chrriss
Thank you guys, this was really helpful Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googl

Re: Validate data & md5

2010-06-04 Thread vekija
Right, but not everyone uses secure connection for user registration, and honestly I can't remember a single site which doesn't clear the password field on registration error. On Jun 5, 3:20 am, calvin wrote: > I don't get that. I think that presents a false sense of security. > > It's best pract

Re: Validate data & md5

2010-06-04 Thread calvin
I don't get that. I think that presents a false sense of security. It's best practice to use a secure connection whenever you're transmitting passwords. And if you're handling the request over secure http, then it doesn't matter if you send the password back to the user. On Jun 4, 10:08 am, vekij

Re: Validate data & md5

2010-06-04 Thread alaxos
If you don't want to reenter the password, you can use a different name for the password input. For instance: View: $this->Form->input('new_password', array('type' => 'password')); Controller: if(!empty($this->data['User']['new_password'])) { $this->data['User']['password'] = $this->Auth->

Re: Validate data & md5

2010-06-04 Thread vekija
When you have an error on the registration form, it is a best practice to clear the password value and force the user to renter that info. So, in the controller... if($this->User->save($this->data)) { // ... whatever you do after user had registered successfully } else { // ... there was an e

Re: Validate REST input

2010-05-23 Thread Emanuele Gringeri
On 05/21/10 18:51, Henrik Gemal wrote: > I have a controller which is being called with different paramters > like: > /test/do?start=2010-01-01&end=2011-01-01&test=1&super=8 > > Now I like to user cake to validate the input parameters. How do I do > that? > > I like to specify that start and end ar

Re: Validate REST input

2010-05-22 Thread Master Ram...!
you can user cakephp validation here the example form cakephp validation. in your model you can user this code. var $validate = array( 'field_name' => array( 'rule' => array( 'minLength',

Re: Validate REST input

2010-05-21 Thread calvin
Use $this->validates() But why not use Cake's named parameters? (e.g. /test/do/start: 2010-01-01/end:2010-01-01/test:1/super:8) On May 21, 11:51 am, Henrik Gemal wrote: > I have a controller which is being called with different paramters > like: > /test/do?start=2010-01-01&end=2011-01-01&test=1&

Re: validate array key => value inconsistency

2010-05-07 Thread John Andersen
No, it is not a bug! It is clearly described in the CakePHP book. 'rule' => 'ruleName', // or: array('ruleName', 'param1', 'param2' ...) Second format is the one you are concerned about I assume, but it is documented. Version 1.3: http://book.cakephp.org/view/1145/One-Rule-Per-Field Version 1.2:

Re: Validate array data

2010-04-27 Thread Akeda Bagus
On Wed, Apr 28, 2010 at 3:15 AM, Jonas wrote: > Hello, > > Can I validate an array that looks like this somehow with the standard > validation rules? > > [Trip] >  [Passengers] >   [1] => Array >        ( >            [passenger_firstname] => >            [passenger_lastname] => >            [pass

Re: Validate on

2010-04-22 Thread Andy Dirnberger
Check the Cookbook http://book.cakephp.org/view/127/One-Rule-Per-Field On Apr 22, 10:10 am, Angelo wrote: > Hello, > > I juste discover ina blog article that we can use a "on" value in > $validate array. > > Is there somewehere documentation about all value we can put in > $validate array? > > Th

Re: Validate CC field

2010-04-15 Thread John Andersen
Sorry, I thought you wanted to save the CC field :) You can instantiate the Validation class yourself and use the email validation method to validate each of your CC addresses. See http://api12.cakephp.org/class/validation#method-Validationemail for the Validation class source. Should someone else

Re: Validate CC field

2010-04-15 Thread Henrik Gemal
Is there a way to manually call the validation checks? So psedo code like: foreach ($ccs as $cc) $validate->email($cc) ? On Apr 15, 5:42 pm, John Andersen wrote: > Yes, you can make your custom validation function for that field. > See the CakePHP book > at:http://book.cakephp.org/view/150

Re: Validate CC field

2010-04-15 Thread John Andersen
Yes, you can make your custom validation function for that field. See the CakePHP book at: http://book.cakephp.org/view/150/Custom-Validation-Rules Enjoy, John On Apr 15, 6:10 pm, Henrik Gemal wrote: > Is there a way to validate a form entry where people can enter one or > more email addresse

Re: Validate query params

2010-04-15 Thread Dr. Loboto
Model may be tableless as well. Validation isn't connected with save process or table fields. http://book.cakephp.org/view/436/useTable http://book.cakephp.org/view/410/Validating-Data-from-the-Controller On Apr 15, 3:31 pm, Henrik Gemal wrote: > In my CakePHP application I have an action that s

RE: Validate Question

2010-01-07 Thread Dave
Behalf Of Miles J Sent: January-07-10 2:24 PM To: CakePHP Subject: Re: Validate Question You will have to set the validation rule during runtime in your model/ controller, like so: $this->Model->validate['field']['inList'] = array('rule' => array ('inList&#

Re: Validate Question

2010-01-07 Thread Miles J
You will have to set the validation rule during runtime in your model/ controller, like so: $this->Model->validate['field']['inList'] = array('rule' => array ('inList', $myListVariable)); On Jan 7, 2:06 am, John Andersen wrote: > Hi Dave, > > Is your rule made in accordance with CakePHP custom v

Re: Validate Question

2010-01-07 Thread John Andersen
Hi Dave, Is your rule made in accordance with CakePHP custom validation rules? If yes, then I don't see a better solution. See http://book.cakephp.org/view/150/Custom-Validation-Rules#Adding-your-own-Validation-Methods-152 for the custom validation rules. Enjoy, John On Jan 7, 7:48 am, "Dav

Re: Validate fields

2010-01-06 Thread BrendonKoz
Alternatively, if this is an update form - if you don't want to update the password for example, and therefore leave it blank, by simply not validating you will update your password to a blank password. Not what you're intending, I'd imagine. If password is set to notEmpty or required, make sure

Re: Validate fields

2010-01-05 Thread frmdstryr
you set the validation rules in the Model of whatever your using (i'm guessing users model) /app/models/user.php search for cakephp validation in google and look in the cakephp manual, it should be what you need. On Jan 5, 6:53 pm, kicaj wrote: > How validate field only we entered some value int

Re: Validate URL not working

2010-01-01 Thread euromark
i'd say your validation array is incorrect 'website' => array( 'RULENAME' => array( array( 'required' => false, 'allowEmpty' => false, 'rule' => array('url', true), 'message' => '* Please enter a valid URL.', 'last' => true), ), ... whereas RULENAME wou

Re: validate as hour

2009-11-30 Thread LunarDraco
This regular Expression will force a number between 0-23 Raw Reg ex: ^1?[0-9]{1}$|^2[0-3]{1}$ I'm remembering for php some of these char in the regex provided need to be escaped. Formated for PHP: /^1?[0-9]{1}$|^2[0-3]{1}$/ And here is a good on line real time tester for regular expressions: htt

Re: validate as hour

2009-11-29 Thread Indemnity83
I would just create a custom validation function: /** * function intRange * * Checks if a value is an integer within the * range given (inclusive) * * @param $value to be checked * @param $start of range * @param $end of range * @return bool */ function intRange($value,$start,$end) {

Re: validate as hour

2009-11-28 Thread Dave
err... never mind... doesn't help with decimals On Sat, Nov 28, 2009 at 1:35 PM, Dave wrote: > He can then add the "numeric" rule as well > > > On Fri, Nov 27, 2009 at 9:30 AM, r4zv4n wrote: > >> 'range' still won't fit his purpose, as it will allow for non-integer >> values ;) >> >> On Nov 27,

Re: validate as hour

2009-11-28 Thread Dave
He can then add the "numeric" rule as well On Fri, Nov 27, 2009 at 9:30 AM, r4zv4n wrote: > 'range' still won't fit his purpose, as it will allow for non-integer > values ;) > > On Nov 27, 8:54 am, jburns wrote: > > Ah - yes - good call. It was late...! > > > > I should have said 'rule' => arra

Re: validate as hour

2009-11-27 Thread r4zv4n
'range' still won't fit his purpose, as it will allow for non-integer values ;) On Nov 27, 8:54 am, jburns wrote: > Ah - yes - good call. It was late...! > > I should have said 'rule' => array('range', -1, 24). > > I agree with you that the best way is to present a drop down list as > that precis

Re: validate as hour

2009-11-26 Thread jburns
Ah - yes - good call. It was late...! I should have said 'rule' => array('range', -1, 24). I agree with you that the best way is to present a drop down list as that precisely controls the available inputs. On Nov 27, 6:39 am, r4zv4n wrote: > 'between' actually means that the data's length shoul

Re: validate as hour

2009-11-26 Thread r4zv4n
'between' actually means that the data's length should be between those numbers (i.e. between 0 and 23 characters), so that won't work. One easy solution would be to use 'inList', like this: 'rule' => array ('inList', array(0,1,2,3,..,23)) I'm assuming that on the client side, you're actually

Re: validate as hour

2009-11-26 Thread jburns
I think you'd have to add two rules which, when combined, only accepts the data you want. A custom rule should do it too - I'll have a go tomorrow if this is still open. In the meantime, try this: http://book.cakephp.org/view/246/decimal ...but with a 0 for the number of decimal places. Don't kno

Re: validate as hour

2009-11-26 Thread ge...@dinnerbooking.com
Kind of. But this also allows "0.01" How would I allow only 0, 1 ...23 and NOT numbers like 0.01 On Nov 26, 7:48 pm, jburns wrote: > array('rule' => array('between', 0, 23), >         'message' => 'Please enter a number between 0 and 23.') > > On Nov 26, 6:41 pm, "ge...@dinnerbooking.com" > > w

Re: validate as hour

2009-11-26 Thread jburns
array('rule' => array('between', 0, 23), 'message' => 'Please enter a number between 0 and 23.') On Nov 26, 6:41 pm, "ge...@dinnerbooking.com" wrote: > I have an field which is an hour: > > "hour" => array( >         "required" => true, >         "allowEmpty" => false, >         "rule" =>

RE: Validate a single field

2009-11-07 Thread Dave
ering or why it error div appears when valid? Any help or suggestions would be great. Thanks Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of euromark (munich) Sent: November-07-09 1:56 PM To: CakePHP Subject: Re: Validate a single fi

Re: Validate a single field

2009-11-07 Thread euromark (munich)
just submit only that field the model validation is only triggered for fields that are beeing passed so if there is only one passed form field, only this one will be validated PS: dont use "required''=>true" in your rules or you screw it up On 7 Nov., 17:43, "Dave" wrote: > How can I validate

Re: Validate zip/postal for Canada OR us

2009-10-19 Thread Josey
actually I was using the default cakephp postal validation but your post directed me towards the creation of a custom validation rule that checked to see if the entry was alphanumeric or just numeric and ran the proper validation rule from there. Thanks for the lead! Josey On Oct 16, 4:48 pm, "

Re: Validate zip/postal for Canada OR us

2009-10-16 Thread Tamim A.
I'm assuming you have a postal($zipcode) function in your model to handle the validation. You could use this to validate the Canadian postal code part: if(preg_match("/^([a-ceghj-npr-tv-z]){1}[0-9]{1}[a-ceghj-npr-tv-z]{1}[0-9]{1}[a-ceghj-npr-tv-z]{1}[0-9]{1}$/i",$zip_code)) return true; Best

  1   2   3   >