Re: Validate a multiple select in cakephp 3.0

2015-02-27 Thread Cake Developer
;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: > > What field are you trying to validate? > > On Friday, February 27, 2015 at 2:02:00 PM UTC+1, Cake Developer wrote: >> >> I s

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('in

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

Validate a multiple select in cakephp 3.0

2015-02-27 Thread Cake Developer
Hello Experts, We have multiple select validation in cakephp 2.x public static function multiple($check, $options = array(), $caseInsensitive = false) { .. } any idea what is equivalent validation in cakephp 3.0 ? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on T

Re: How to validate if associated Model exists when saving

2015-01-27 Thread John Andersen
> > class Order { >var $belongsTo = array('Customer');} > > Is there a standard way in CakePHP to validate if the record pointed to by > the customer_id field exists? > > $this->Order->create(); > $this->Order->set('customer_id', 1

Re: How to validate if associated Model exists when saving

2015-01-27 Thread John Andersen
'Order' model associated with the 'Customer' model. > > class Order { >var $belongsTo = array('Customer');} > > Is there a standard way in CakePHP to validate if the record pointed to by > the customer_id field exists? > > $this->Order->cr

How to validate if associated Model exists when saving

2015-01-27 Thread JP
Suppose I have an 'Order' model associated with the 'Customer' model. class Order { var $belongsTo = array('Customer');} Is there a standard way in CakePHP to validate if the record pointed to by the customer_id field exists? $this->Order->create()

Re: Add validate notInList($check, array())

2014-06-10 Thread euromark
I am not sure there is a broad enough use case to add this as a core rule. As you pointed out this can easily be done in user land code without a lot of overhead. I think this is how it should stay. Am Dienstag, 10. Juni 2014 14:11:32 UTC+2 schrieb quy le: > > I know core CakePHP has va

Add validate notInList($check, array())

2014-06-10 Thread quy le
I know core CakePHP has validate inList(), Example: Now I want to check value that client submit to server if it's not in List(1, 2, 3) then return false I can add a method in Model to validate it public method notInList($check, $array()){ return !in_array($check, $array); } but i think

RE: Validate Dynamic Forms

2014-05-22 Thread Advantage+
Sorry that makes no sense. Add or remove from what fieldname since we do not know the name? How do you validate the name of the field when the name is generated dynamically? User makes a quiz with 20 questions, 15 questions that will need a text area, the other 5 are yes/no radio inputs

Re: Validate Dynamic Forms

2014-05-22 Thread Stephen S
to a form > (either yes or no or text answer response) > > So the Question has id, quiz_id, question, type (text or true / false), > > > > But how would you validate this? > > > > In the view I simply do a foreach ($questions as $question){ > > echo $this->F

Validate Dynamic Forms

2014-05-22 Thread Advantage+
I am building a questionnaire where the user can add questions to a form (either yes or no or text answer response) So the Question has id, quiz_id, question, type (text or true / false), But how would you validate this? In the view I simply do a foreach ($questions as $question){ echo

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

Validate if not between

2013-11-18 Thread Salines
Hi, folks Is there any validation rules that check sent data does not exist between two dates? Or need to make a custom validation method? If there is no data between two dates validation must return TRUE or FALSE if it exists. Syntax as follows SELECT pub_name, country, pub_city, estd FROM p

Re: Translate Behavior Save and Validate more languages

2013-10-12 Thread Tahiri Abdou
try $this->Model->saveAssociated($data); On Monday, May 7, 2012 2:33:41 PM UTC+1, manzapanza wrote: > > I'm trying to Save and Validate categories with 3 translations for the > field 'name' using TranslateBehavior. > I have a problem with the validat

Re: Translate Behavior Save and Validate more languages

2013-07-06 Thread Hervé Thouzard
I also have many problems with the translate behavior and fields display and save -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe

Re: Translate Behavior Save and Validate more languages

2013-07-04 Thread Senén
itto: >> >> I'm trying to Save and Validate categories with 3 translations for the >> field 'name' using TranslateBehavior. >> I have a problem with the validation of the field with Translation. >> >> Model/Category.php >> >> public

Re: How to validate current password.

2013-06-16 Thread euromark
if you google "cakephp validate current password" you will hit a lot of results like http://lecterror.com/articles/view/manually-hashing-password-and-password-validation You can also read, implement or get some info on how do validate (from the source code): http://www.dereuromark.de/

How to validate current password.

2013-06-16 Thread kani
Fields are | current password | new password | repeat new password -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this g

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
escreveu: > > If the model has no access to Ssession data from correct MVC structure how > do you validate user_id in the model when saving records? > > > > Auth saves the user_id in the session when logged in but if you cannot get > that in the model how do you verify t

Re: Validate Question

2013-05-10 Thread Chetan Varshney
['User']['id'])) { $userId =$this->auth['User']['id']; } On Fri, May 10, 2013 at 4:24 PM, Advantage+ wrote: > If the model has no access to Ssession data from correct MVC structure how > do you validate user_id in the model when saving records

Validate Question

2013-05-10 Thread Advantage+
If the model has no access to Ssession data from correct MVC structure how do you validate user_id in the model when saving records? Auth saves the user_id in the session when logged in but if you cannot get that in the model how do you verify the user_id? -- Like Us on FaceBook https

Re: Can't validate URL

2013-01-25 Thread Luciano Bargmann
My advise: Use http://yourls.org/ On Thursday, January 24, 2013 4:45:50 PM UTC-7, gonzela2006 wrote: > > Hello euromark, > > Thanks for your reply > I'm trying to make my own short link service for my blog and I wish to > make it using CakePHP > I think I can't

Re: Can't validate URL

2013-01-24 Thread gonzela2006
Hello euromark, Thanks for your reply I'm trying to make my own short link service for my blog and I wish to make it using CakePHP I think I can't validate this URL because it is too long *Note*: I have tried to encode this URL before validate it and still getting false URL. Ple

Re: Can't validate URL

2013-01-24 Thread euromark
you should be a little bit more verbose and descriptive. so this url you posted (and which looks like a spam url) is what you tried to validate using the validation rule "url"? and it returned false? where did you even get this url? because as a valid url it wouldbe more sth like

Re: Can't validate URL

2013-01-24 Thread gonzela2006
Hello euromark, No spam, I'm just trying to find a solution to my problem in different places. On Thursday, January 24, 2013 6:59:20 PM UTC+2, euromark wrote: > > the same spam as > http://stackoverflow.com/questions/14505837/cakephp-cant-validate-url ? > > Am Donnerstag

Re: Can't validate URL

2013-01-24 Thread euromark
the same spam as http://stackoverflow.com/questions/14505837/cakephp-cant-validate-url ? Am Donnerstag, 24. Januar 2013 17:16:49 UTC+1 schrieb gonzela2006: > > Hello, > > can't validate the below url using 'rule' => 'url' on my model > > > https:

Can't validate URL

2013-01-24 Thread gonzela2006
Hello, can't validate the below url using 'rule' => 'url' on my model https://www.google.com/search?sugexp=les;&gs_rn=1&gs_ri=serp&tok=ryp3YY4UdU39xLhgeQ6ElQ&pq=cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cak

Re: validate select field in a Model

2012-11-01 Thread Chris
female >>> >>> >>> So you should use in following way- >>> >>> Configure::write('User.**genders', array(''=>'unknown', '1'=>'male', >>> '2'=>'female

Re: validate select field in a Model

2012-11-01 Thread Chetan Varshney
>> >> >> unknown >> male >> female >> >> >> So you should use in following way- >> >> Configure::write('User.**genders', array(''=>'unknown', '1'=>'male', >> '

Re: validate select field in a Model

2012-11-01 Thread Chris
female')); > > rest code is same > > > On Thu, Nov 1, 2012 at 3:53 PM, Chris >wrote: > >> >> hi guys,... I'm using cake 1.3 >> how can I validate "select" field from Model,? >> >> what I have in bootstrap: >> Co

Re: validate select field in a Model

2012-11-01 Thread Chris
$this->redirect($_SERVER['HTTP_REFERER']); } thanks man,... On Thursday, November 1, 2012 5:13:48 AM UTC-7, jsundquist wrote: > > A select dropdown will never be empty unless one of the options is an > empty string. > > - Jon > On Nov 1, 201

Re: validate select field in a Model

2012-11-01 Thread Chetan Varshney
On Thu, Nov 1, 2012 at 3:53 PM, 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', 

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: &

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

validate select field in a Model

2012-11-01 Thread Chris
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: Form->select('gender&#

Re: How do i validate multiple fields using the same field name?

2012-09-16 Thread resting
p >>> >>> On Friday, 14 September 2012 15:42:36 UTC+8, resting wrote: >>>> >>>> I have something like this in my view: >>>> >>>> echo $this->Form->input('Modelname.1.fieldname'); >>>> >>>> (ref: >>>&g

Re: How do i validate multiple fields using the same field name?

2012-09-16 Thread resting
14 September 2012 15:42:36 UTC+8, resting wrote: >>> >>> I have something like this in my view: >>> >>> echo $this->Form->input('Modelname.1.fieldname'); >>> >>> (ref: >>> http://book.cakephp.org/2.0/en/core-libraries/

Re: How do i validate multiple fields using the same field name?

2012-09-16 Thread euromark
e: >> >> I have something like this in my view: >> >> echo $this->Form->input('Modelname.1.fieldname'); >> >> (ref: >> http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions) >> >>

Re: How do i validate multiple fields using the same field name?

2012-09-16 Thread resting
> I have something like this in my view: > > echo $this->Form->input('Modelname.1.fieldname'); > > (ref: > http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions) > > > > I have this in my model: > > public $valida

How do i validate multiple fields using the same field name?

2012-09-14 Thread resting
I have something like this in my view: echo $this->Form->input('Modelname.1.fieldname'); (ref: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#field-naming-conventions) I have this in my model: public $validate = array( 'filename' =

Re: Error when I use the $validate in the model file

2012-09-06 Thread shyandsy
Hi, sorry, I have forgot this question I already catch this problem Thanks very much, my friend 在 2012年8月24日星期五UTC-5上午3时17分46秒,Chetan Patel写道: > > Hello friends > > Your mystake is minor, > > Just replace "alphaNumberic" with "alphaNumeric". > >

Re: Error when I use the $validate in the model file

2012-08-24 Thread Chetan Patel
Hello friends Your mystake is minor, Just replace "alphaNumberic" with "alphaNumeric". Then Your validate array would be like below public $validate = array( 'username' => array( 'alphaNumberic' => array(

Error when I use the $validate in the model file

2012-08-23 Thread shyandsy
What I did I used the cakePhp What happened When I use $validate in the model file to check the user input, the warning information like below: Warning (2): preg_match(): Delimiter must not be alphanumeric or backslash [CORE\Cake\Model\Validator\CakeValidationRule.php, line 276] The regular

Re: how to validate a page

2012-06-08 Thread Tilen Majerle
can u describe your problem more clear please :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/6/8 georgio ch > How can i validate a page inside default layout so that when i change > page the default content must change or stay the same depends the > page i am clicking >

how to validate a page

2012-06-08 Thread georgio ch
How can i validate a page inside default layout so that when i change page the default content must change or stay the same depends the page i am clicking -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http

Re: Translate Behavior Save and Validate more languages

2012-05-08 Thread manzapanza
Some suggestions? Thanks! Il giorno lunedì 7 maggio 2012 10:33:41 UTC-3, manzapanza ha scritto: > > I'm trying to Save and Validate categories with 3 translations for the > field 'name' using TranslateBehavior. > I have a problem with the validation of the field w

Translate Behavior Save and Validate more languages

2012-05-07 Thread manzapanza
I'm trying to Save and Validate categories with 3 translations for the field 'name' using TranslateBehavior. I have a problem with the validation of the field with Translation. Model/Category.php public $actsAs = array('Translate' => array('name' =>

cakephp-mongodb validate subdocuments

2012-04-27 Thread Dmitriy Salko
Hello everybody, I'm using https://github.com/ichikaway/cakephp-mongodb in my cakephp app and want to use cake validation. But have no idea how to validate sub-documents. Did anyone do something like this before? Thanks! -- Our newest site for the community: CakePHP Video Tutorials

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

validate access to bootstrap-var

2012-01-04 Thread Ivo Wolgensinger
I want to validate if the entered value in a form is equal to a variable defined in bootstrap.php. This is my code (snippet): 'actualgtb' => array ( 'rule' => array('equalTo', Configure::read('GTB.version')),

login validation does not work with $validate

2011-12-28 Thread Tomfox Wiranata
x27; => '', 'type' => 'password', 'id' => 'UserPw') ); echo $form->button('Einloggen', array('type' => 'submit', 'class'=>'button', 'i

Re: How Check validate before save

2011-12-01 Thread phpMagpie
Adding 'validate'=>'only' will never save as your asking the function to only validate the data. If 'incorrect' data is passing validating then you have something wrong with your validation rules. Paul. -- Our newest site for the community: CakePHP Video

Re: How Check validate before save

2011-11-30 Thread euromark
I dont understand your code - where do you actually save your data? as of right now you only validate it... On 30 Nov., 12:17, Mamdoohi wrote: > ok. > I have two model ( user, employee ). > and use this code > > if($this->Employee->saveAll($this->data,array('val

Re: How Check validate before save

2011-11-30 Thread Mamdoohi
ok. I have two model ( user, employee ). and use this code if($this->Employee->saveAll($this->data,array('validate'=>'only')){ $this->Session->setFlash('Saved'); $this->redirect('/'); }else{ $this->Session->setFlash(&

Re: How Check validate before save

2011-11-30 Thread phpMagpie
> As others have said when you call your models save() method it will check validation by default. save() will not validate associated data as it only saves the current model. As I stated previously saveAll() will validate associated model data in a properly formatted data array. HTH, P

Re: How Check validate before save

2011-11-29 Thread andrewperk
: http://api20.cakephp.org/class/model On Nov 27, 12:02 am, Mamdoohi wrote: > hi > I want validate data before save. > my data is for two table so I want check validate then save data into two > table > > how can do it? -- Our newest site for the community: CakePHP Vide

Re: How Check validate before save

2011-11-29 Thread phpMagpie
CakePHP will do this for you automagically when using Model::saveAll(). HTH, Paul. -- 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 uns

Re: How Check validate before save

2011-11-27 Thread euromark
does this help? http://www.dereuromark.de/2010/06/20/validating-multiple-models-at-once/ On 27 Nov., 09:02, Mamdoohi wrote: > hi > I want validate data before save. > my data is for two table so I want check validate then save data into two > table > > how can do it? -- O

How Check validate before save

2011-11-27 Thread Mamdoohi
hi I want validate data before save. my data is for two table so I want check validate then save data into two table how can do it? -- 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

Re: How to validate hasAndBelongsToMany multiple-select?

2011-11-21 Thread phpMagpie
If you're using the core 'multiple' validation rule then I was involved in many discussions about this some time back, the following search should provide all the reading you require: https://groups.google.com/forum/#!searchin/cake-php/validate$20multiple$20rule HTH, Paul. --

How to validate hasAndBelongsToMany multiple-select?

2011-11-20 Thread Mattia Manzati
I all, I'm trying to use the "multiple" validation method, but it seems that it doesn't works... This is my model: https://gist.github.com/1380696 Thanks in advance for any help! ^^ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Qu

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 fie

Re: how can I validate this field?

2011-10-15 Thread Marcus James
Hi heohni Well for your first problem, the email one, add allowEmpty validation in that, for your password validation i am sure you are encrypting your password , what i suggest is you must first validate all the form field and if successful then encrypt your password field before saving

Re: how can I validate this field?

2011-10-15 Thread Jeremy Burns | Class Outfit
>> @seehttp://www.dereuromark.de/2010/09/21/saving-model-data-and-security/ >> for details >> >> On 14 Okt., 20:46, heohni >> wrote: >> >> >> >> >> >> >> >>> I found another str

Re: how can I validate this field?

2011-10-15 Thread WebbedIT
t; wrote: > > > > > > > > > I found another strange thing: > > > this is the complete model validation: > > var $validate = array( > >         'ben_name' => array( > >             'required' => array('rule' =&

Re: how can I validate this field?

2011-10-14 Thread euromark
ones are not checked as well (overhead and totally useless)." @see http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/ for details On 14 Okt., 20:46, heohni wrote: > I found another strange thing: > > this is the complete model validation: > var $validate = a

Re: how can I validate this field?

2011-10-14 Thread heohni
I found another strange thing: this is the complete model validation: var $validate = array( 'ben_name' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyName') ), &

how can I validate this field?

2011-10-14 Thread heohni
Hi, my email field has this rules: 'ben_email' => array( 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail'), 'email' => array('rule' => array('email', true), 'message' => 'SyntaxEmail'), 'unique' => array('rule' => 'isUnique', 'message' => 'Em

Re: flash message when validate in model doesn't work

2011-10-11 Thread WebbedIT
Why are you validating within a model? On Oct 10, 3:26 pm, taqman filler wrote: > I need to fix it > > 2011/10/10 euromark : > > > > > > > > > so what exactly do you want from us?^^ > > > On 10 Okt., 14:53, taqman filler wrote: > >> but flash message in auth or other action is work > > >> thanky

Re: flash message when validate in model doesn't work

2011-10-10 Thread taqman filler
I need to fix it 2011/10/10 euromark : > so what exactly do you want from us?^^ > > > On 10 Okt., 14:53, taqman filler wrote: >> but flash message in auth or other action is work >> >> thankyou > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check ou

Re: flash message when validate in model doesn't work

2011-10-10 Thread euromark
so what exactly do you want from us?^^ On 10 Okt., 14:53, taqman filler wrote: > but flash message in auth or other action is work > > thankyou -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org

flash message when validate in model doesn't work

2011-10-10 Thread taqman filler
but flash message in auth or other action is work thankyou -- 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

Re: My Model doesn't validate anything

2011-06-28 Thread euromark
> > liked a lot what I've seen until now. > > > > I am following examples for Model Data Validation through the > > > $validate var but I don't what I might be doing wrong but my model > > > doesn't validate anything, I mean, it throws error for

Re: My Model doesn't validate anything

2011-06-27 Thread Jamie
well, I've > > liked a lot what I've seen until now. > > > I am following examples for Model Data Validation through the > > $validate var but I don't what I might be doing wrong but my model > > doesn't validate anything, I mean, it throws error for ever

Re: My Model doesn't validate anything

2011-06-26 Thread euromark
am following examples for Model Data Validation through the > $validate var but I don't what I might be doing wrong but my model > doesn't validate anything, I mean, it throws error for every field, > even for date one and that's already put by CakePHP form helper so no > way

My Model doesn't validate anything

2011-06-26 Thread Ciul
Hi CakePHP pals. I'm reading about CakePHP, I come from CodeIgniter and well, I've liked a lot what I've seen until now. I am following examples for Model Data Validation through the $validate var but I don't what I might be doing wrong but my model doesn't validate an

Re: Can't validate model ?!

2011-05-30 Thread Niels Stevens
;> } >> } >> >> } >> >> } >> >> ?> >> >> If i don't type anything in my form my add method gets to the debug >> statement. Which I find strange because

Re: Can't validate model ?!

2011-05-30 Thread euromark
m my add method gets to the debug > statement. Which I find strange because I use the isset($this->data). > my debug print out looks like this : > Array > ( >     [Link] => Array >         ( >             [link_name] => >             [link_url] => >             [link_c

Can't validate model ?!

2011-05-30 Thread Niels
my link model array( 'rule' => 'notEmpty' ), 'link_url' => array( 'rule' => 'notEmpty' ) ); /* var $validate = array(

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'

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 &

Re: Validate from within a model

2011-04-28 Thread func0der
ase. This user is getting an error message that something fails during the file upload and also i want to let the users know what they are supposed to do next. This is my intention. And i would never validate file uploads with javascripts because of 2 reasons: First, i don't know how Second,

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 

Validate from within a model

2011-04-27 Thread func0der
Hey guys, i'm having a file upload here. I'm using "afterSave" to place the uploaded file in the filesystem. function afterSave($created){ //get the entry id $this->data['DataFile']['id'] = $this->getInsertId(); if(!$this->saveDataFile($this

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
; > $this->Post->set($this->data); > > //Debug($this->Post->saveAll( $this->data, array('validate' => 'only'))); > $this->Post->saveAll( $this->data, array('validate' => 'only') ) > > If I manually set data to the

RE: Validate HABTM Multiple

2011-04-03 Thread Krissy Masters
->Post->set($this->data); //Debug($this->Post->saveAll( $this->data, array('validate' => 'only'))); $this->Post->saveAll( $this->data, array('validate' => 'only') ) If I manually set data to the Category I get the message

Re: 1 form 2 models - how to validate without savingAll?

2011-04-03 Thread func0der
yeah... a quick overview over the cake "model.php" in "cake/libs/model/ model.php" shows me, that --- if ($this->ModelName->saveAll($this->data, array('validate' => 'only'))) {.. --- Does exactl

Re: Validate HABTM Multiple

2011-04-03 Thread euromark
"but I never get any validation errors for the HABTM model " what does $this->Post->saveAll() return? boolean or array? pr() it pretty quick - I had similar issues I think On 1 Apr., 05:37, "Krissy Masters" wrote: > I can, but why should I have to validate t

Re: 1 form 2 models - how to validate without savingAll?

2011-04-02 Thread netusco
Hi func0der, don't take it bad but I think you didn't read well my post, neither the title... I ask how to do it without savingAll, as I wanted to validate data in diferent steps and save at the end. Then as euromark pointed out in his blog the if statements check the first element

  1   2   3   4   5   6   7   >