Have you confirmed that the validation function is actually getting called,
via CakeLog::debug() or error_log(print_r($data, true));
If your validation function only returns false, and it never gets called,
mostly likely, validation is not getting called at all.
If the data is data['Community']
I cannot validate my year select.
When posted it appears as :
data[Comunity][start][year]...
2009
Validation rule:
'start' => array(
'required' => true,
'allowEmpty' => false,
'rule' => array('checkYearValues', 'start'),
'message' => 'Please enter a year
When doing your own validation rules (which would definitely be needed
here), you can access all fields on the submitted form via $this->data.
Here's an example where I validate for a PO Box on an address, if the
street name is blank.
function validatePOBox($check) {
$key = current($check);
$ke
How do you validate / invalidate 1 field based on the other.
Example:
User changing password I have
Confirm current (no issues there)
New Password input
Confirm New Password input
Now I have it set password has to be minimum 8 characters for the sake of
the question.
User enters new p
ok. i figured it out. The models being saved can be accessed in the
validation rule through $this->data.
On Wed, Jun 6, 2012 at 10:29 AM, Michael Gaiser wrote:
> I guess my question is: How do you get access to all the other
> associated data that is being saved? I can set it up so I catch it
> b
I guess my question is: How do you get access to all the other
associated data that is being saved? I can set it up so I catch it
before the save happens, but it feels kind of hacky and does not make
use of the field error message code.
--
Our newest site for the community: CakePHP Video Tutorial
ok... How would you test if other associations were submitted? The
example in the docs does not really work for what I want to test
against. How do I get access to all the other fields submitted to be
saved?
On Tue, Jun 5, 2012 at 9:44 PM, John Hardy wrote:
> Write your own validation routine.
>
Write your own validation routine.
On Jun 5, 2012, at 5:45 PM, Michael Gaiser wrote:
> I have a Domain Model that has 4 "has Many" relationships with 4
> different join models (Character, Clan, Covenant, Coterie). When
> creating a new record, the user is presented with 4 option boxes, each
> fi
I have a Domain Model that has 4 "has Many" relationships with 4
different join models (Character, Clan, Covenant, Coterie). When
creating a new record, the user is presented with 4 option boxes, each
filled with different data pertaining to the 4 associated models but
defaulting to an empty option
Hi,
thanks, this works for me except the problem that I get this error
message:
Do you know why this is happening?
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near '_validationRule
http://book.cakephp.org/view/1230/Localization-in-CakePHP
Reload invalidate() method.
On 13 окт, 18:38, heohni wrote:
> Hi,
>
> I have this in my app_model.php
> public $validate = array();
>
> public function __construct($id = false, $table = null, $ds =
> null) {
> parent::__constr
Hi,
I have this in my app_model.php
public $validate = array();
public function __construct($id = false, $table = null, $ds =
null) {
parent::__construct($id, $table, $ds);
$this->_validationRules();
}
And this way I have my model
unction _validationRules() {
$th
I thought as much...
If you add the id field:
echo $this->Form->input('id');
...Cake will automatically i) hide it and ii) populate it with the id value of
the record. Make sure the id value is part of the data you are sending to the
form (die(debug($this->data)) will confirm that).
Then when
Sorry I was over panicing!
When I add the right hidden id and use the normal build in isUnique
rule, all works fine!
Thanks for the help and teh great patience!!!
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http
Oha!
My fault!!
echo $form->hidden('agent_id'); <== WRONG
echo $form->hidden('id', array('value' => $this->data['Agent']
['id'])); <== RIGHT!!
But I can't use isUnique, because this rule also proofs on UPDATES but
I need it only on ADD - what can I finally do?
On 13 Mai, 14:14, heohni wrote:
>
Even when I deactivate the isUnique validation rule, open my edit
form, and empty one of the required fields and submit, I get the
expected error message.
BUT when I add a new value into this field and I submit I get a new
dataset saved in my DB.
I really don't understand this
--
Our newest
Let's go back to basics a bit.
Is agent_id the primary key of your table?
What does $this->data look like when you submit the form?
Wat do your validation rules look like now?
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 13 May 2011, at 13:09, heohni wro
OK, but even I do
echo $form->hidden('agent_id');
which will output:
The isUnique rule will take place as soon as I modify any of my
fields.
This drives me mad :-(
On 13 Mai, 13:57, Jeremy Burns | Class Outfit
wrote:
> You need to place an id field in your form using the form helper. Withou
You need to place an id field in your form using the form helper. Without it,
Cake will assume you are doing an insert, not an update.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 13 May 2011, at 12:55, heohni wrote:
> No, there is no id field.
> I double
No, there is no id field.
I double checked beforeValidate() and debuged $this->data. There is no
id field.
The id is given within the URL when entering the update form, but with
the first submit and upcoming error messages, the ID gets lost within
the URL.
'agt_nummer_uni'=>array(
Do you have an id field on the form (and therefore in the data array)?
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 13 May 2011, at 12:15, heohni wrote:
> Ok I see and I removed the required=> true.
> But this is not solving my problem.
>
> When I open th
Ok I see and I removed the required=> true.
But this is not solving my problem.
When I open the edit form, and I delete on of my required fields ans I
submit => I get the error 'cant be empty...'
But when I fill it, the isUinique message appears, and futher => when
I change the value of the isUniq
You have 'required' => true, which means the validation expects an array key
for it in $this->data. Remove that from the validation and try again. notEmpty
will still work; this checks that if the key
$this->data['Client']['agt_number'] is present, it has a value.
See the yellow note here for a
Hi,
I am saving client data, the client number has this rule:
'agt_nummer' => array(
'agt_nummer_not_empty' => array(
'rule'=> 'notEmpty',
'required' => true,
'message' => 'Dieses Feld darf nicht leer sein.'
),
'ag
Always listen to John - he is usually right.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17 Feb 2011, at 14:24, Tapan Kumar Thapa wrote:
> Issue resolved:-)
>
> Many thanks John for pointing me to the correct point.
>
> My model file name was incom
*Issue resolved:-)*
Many thanks John for pointing me to the correct point.
My model file name was incomings.php by mistake i think so and that is why
validation was not working.
Many thanks to Jeremy as well for helping me out.
Regards
Tapan Thapa
India
On Thu, Feb 17, 2011 at 6:19 PM, Jo
Check your file names! Your model file name should be incoming.php!
If it is not, then you may actually be using the AppModel instead of
the Incoming Model class!
Enjoy,
John
On 17 Feb., 13:05, Tapan Kumar Thapa
wrote:
> If i put debug statement nothing gets print in my incoming view.
>
> If i
Then something else is astray. Is debug set to 2?
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17 Feb 2011, at 12:05, Tapan Kumar Thapa wrote:
> If i put debug statement nothing gets print in my incoming view.
>
> If i also put die statement then complete
Damn!! now I am pissed - zip up your model and controller files and
paste a URL to download
I want the actual files you are using not cut and paste
Tarique
On Thu, Feb 17, 2011 at 5:35 PM, Tapan Kumar Thapa
wrote:
> If i put debug statement nothing gets print in my incoming view.
>
> If i also
If i put debug statement nothing gets print in my incoming view.
If i also put die statement then complete page dies and i got blank white
blank page.
Incoming->set(array(
'Incoming' => $this->params['named']
));
debug($this->Incoming->validates());
//die(debug
Also try a save() before checking for validation errors.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17 Feb 2011, at 11:44, Jeremy Burns | Class Outfit wrote:
> Try something for me...
>
> debug($this->Incoming->validates());
>
> die(debug($this->Incomi
But that's what the model does - so why not set up your validation rules and do
a save? If it fails validation it will not save and you'll get back an array of
validation errors, which you can then process.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17
Try something for me...
debug($this->Incoming->validates());
die(debug($this->Incoming->validationErrors));
...rather than checking for true or false.
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17 Feb 2011, at 11:40, Tapan Kumar Thapa wrote:
> Still n
I want to validate user input in http get url before inserting into my
database table.
If user is not sending any data or sending invalid character data in my
named parameters then i want to use built in validation feature available in
cake php and throw different error message for each named para
Still not working. :-(
My Url:
http://localhost/cakephp/incomings/request/msisdn:/operator:AIRTEL/circle:DELHI
My Controller:
Incoming->set(array(
'Incoming' => $this->params['named']
));
//$this->Incoming->set($this->params['named']);
if ($this->Incom
Why do you need to validate it? Is it not enough to just check the value?
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 17 Feb 2011, at 11:33, Tapan Kumar Thapa wrote:
> Sorry to say but it is still not working.
>
> Url:
> http://localhost/cakephp/incomin
Sorry to say but it is still not working.
Url:
http://localhost/cakephp/incomings/request/msisdn:/operator:AIRTEL/circle:DELHI
Incoming controller:
Incoming->set($this->params['named']);
if ($this->Incoming->validates()) {
$this->Session->setFlash("Correct");
} else {
When you are setting the model data using the set() method, then you
should provide it with at standard structure, not just the value of
the msisdn parameter.
[code example]
$this->Incoming->set( array(
'Incoming' => $this->params['named']
) );
[/code example]
Enjoy,
John
On 17 Feb., 12:09
Try $this->Incoming->set($this->params['named']);
Tarique
On Thu, Feb 17, 2011 at 4:39 PM, Tapan Kumar Thapa
wrote:
> I am dam got stuck here.
>
> Can some one suggest anything?
>
> BR
> Tapan Thapa
>
> On Thu, Feb 17, 2011 at 10:02 AM, Tapan Kumar Thapa
> wrote:
>>
>> Hello,
>>
>> Now i am try
I am dam got stuck here.
Can some one suggest anything?
BR
Tapan Thapa
On Thu, Feb 17, 2011 at 10:02 AM, Tapan Kumar Thapa <
tapan.th...@hindustantimes.com> wrote:
> Hello,
>
> Now i am trying like this.
>
>
> http://localhost/cakephp/incomings/request/msisdn:/operator:AIRTEL/circle:DELHI
>
> b
Hello,
Now i am trying like this.
http://localhost/cakephp/incomings/request/msisdn:/operator:AIRTEL/circle:DELHI
but still validation from model class it not working. Please please suggest.
My Model:
array(
'required' => true,
'allowEmpty' => false,
'rule'
I don't mind using URL like this but are you sure that validation will work
like this?
Regards
Tapan Thapa
Sent from my iPhone
On Feb 16, 2011, at 11:36 PM, euromark wrote:
> you are mixing cake pretty urls and plain url style
>
> why not going with
> /.../x:1/y:2/z:3
> and using
> $this->p
you are mixing cake pretty urls and plain url style
why not going with
/.../x:1/y:2/z:3
and using
$this->params[named]
?
if you don't mind my asking
On 16 Feb., 12:49, Tapan Thapa wrote:
> Hello Community,
>
> I want to create a url like this.
>
> http://localhost/cakephp/incomings/request/?ms
Hello Community,
I want to create a url like this.
http://localhost/cakephp/incomings/request/?msisdn=919871701375&operator=AIRTEL&circle=DELHI
and i am accepting this request in my controller like below code and
passing it to model for validation but it is not working in case i
left any variabl
> I agree 2 emails is confusing.
Then you should rethink your choice, it's not just confusing but
limiting as anyone with only one email will not be able to use your
site.
> My problem is the users Profile email has to
> be visible in my setup as its how to contact the person so no option to hide
On Mar 23, 12:26 pm, "Dave" wrote:
> I agree 2 emails is confusing. My problem is the users Profile email has to
> be visible in my setup as its how to contact the person so no option to hide
> it.
In the admin views, don't even bother checking the display_email
field. It'll only be admins who se
since User <-> Profile are related its no big issue to pull the data at any
point
Dave
-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cricket
Sent: March-23-10 12:39 AM
To: CakePHP
Subject: Re: Weird Validation Question
Use a single
I agree with cricket as it's more likely a person will have one email
address and will chose to make it public or not. In the site I am
currently designing I am allowing messages to be sent through the site
so no-one gets to see other members emails. But each member can chose
to display their ema
m] On Behalf
>
> Of John Andersen
> Sent: March-22-10 4:33 AM
> To: CakePHP
> Subject: Re: Weird Validation Question
>
> Are your User and Profile models not associated/related to each other
> - User hasOne/belongsTo Profile?
> If you have that relationship, then just query
-...@googlegroups.com] On Behalf
Of John Andersen
Sent: March-22-10 4:33 AM
To: CakePHP
Subject: Re: Weird Validation Question
Are your User and Profile models not associated/related to each other
- User hasOne/belongsTo Profile?
If you have that relationship, then just query for the Profile with user_id
equal the
Are you not allowing the person to update their user and profile
details at the same time? If you were both values would be in the
data array to be compared.
If you're not then you must be including the user's id in the data
array either by a hidden field in the form or by setting it before
save/
Are your User and Profile models not associated/related to each other
- User hasOne/belongsTo Profile?
If you have that relationship, then just query for the Profile with
user_id equal the Auth->user('id') :)
Enjoy,
John
On Mar 22, 2:39 am, "Dave" wrote:
> This might be odd but i have user ema
This might be odd but i have user email and profile email.
User email is not published on the site (used for account, login, forgot
stuff like that) profile email is published on the site so for security i
figured that its best to use a separate email.
So when a user wants to edit either of the
I forgot to mention, you need to set $this->Model->id before you call
saveField
On Tue, Dec 8, 2009 at 6:06 PM, Dave wrote:
> Sounds like you are creating a new entry instead of saving the data from
> the current one.
>
> Try using $this->Model->saveField('field_name','value');
>
> So in your co
Sounds like you are creating a new entry instead of saving the data from the
current one.
Try using $this->Model->saveField('field_name','value');
So in your controller check which field they have field out, and call
saveField for only that field.
On Tue, Dec 8, 2009 at 1:30 PM, Dave wrote:
>
I am attempting to allow user to edit their url and email, so i load the
form up and leave it blank since both have to be unique if its filled with
their original info and edit 1 field the other will fail because it says
email / or url already exists since they only changed one. So save the form
an
I am submitting a form using ajax and have a few questions.
I found pseudocoders validation plugin, looked at few others but not working
quite the way i want.
Can you submit the form ajax without validating the form and have nothing
happen until the response is sent back from the model / contr
Hi Dave,
If the field being validated is located in a table, wherein the users
id also is, then you can create a unique index on the combination
(field + user_id) for the table, thus having the database taking care
of the validation.
Enjoy,
John
On Aug 31, 8:13 pm, "Dave Maharaj :: WidePixel
http://book.cakephp.org/view/152/Adding-your-own-Validation-Methods
On Sep 1, 12:13 am, "Dave Maharaj :: WidePixels.com"
wrote:
> I need to add a custom validation rule but cant quite figure out how to do
> it.
>
> The field being validated has to be unique specific to the user. So User1
> can u
I need to add a custom validation rule but cant quite figure out how to do
it.
The field being validated has to be unique specific to the user. So User1
can use 'foo' , User2 can use 'foo' but each user cannot use 'foo' twice.
What would be the best way to handle something like this?
Dave
-
In your view I think you should be using input names like
'user.firstname'. Make use of the debug(...) call in your debugging.
In your controller, use debug($this->params) to look at data coming
from the form then you can determine what it is looking for.
On May 22, 10:30 pm, Wayne wrote:
> G
Anyone? Please help...
On May 22, 7:30 pm, Wayne wrote:
> Greetings,
>
> I am new to CakePHP and am having trouble displaying the form
> validation errors from my registration form. After extensive research
> online, I feel I am missing something obvious. Maybe I am incorrectly
> assuming that C
Greetings,
I am new to CakePHP and am having trouble displaying the form
validation errors from my registration form. After extensive research
online, I feel I am missing something obvious. Maybe I am incorrectly
assuming that Cake will display the error next to the appropriate form
field.
Here
...or make use of callback Model::beforeValidate()
"$validate" is PHP class member so it must be constant expression.
(not variable function)
On May 11, 4:17 am, Miles J wrote:
> Well you could place the validation array on the $validate property
> within AppModel.
--~--~-~--~~--
Well you could place the validation array on the $validate property
within AppModel.
--~--~-~--~~~---~--~~
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 u
Throughout my application i have about 100 various input fields in forms.
Most use the same validation rules max min alphanumeric and so on
Is it possible to define a set of validation rules in app_model that can be
used in the other models rather than adding the same rules over and over to
every
first you need allowEmpty => true for your radio buttons
then, you simply need a custom validation rule for the 'other' field
'other => array('rule'=>array('checkOther'));
function checkOther() {
if(///check if radio buttons are empty && 'other' is not decimal///)
{
return false;
}
re
I find myself a little stumped on this one, maybe some can offer some
insight.
I need a "donate" form that will be sent via SSL to our merchant
processing facility. I need a set of radio buttons that have a
suggested donation amount (accomplished using form->radio('Amount',
array('1000.00' =>'$10
Yup, you've got it right. The only improvement would be that you don't
need to give an index for each of the rules under zip.
var $validate = array(
'zip' => array(
array(
'rule' => array('postal', null, 'us'),
'message' => 'Must be a vali
I have read the posts extensively on this topic and believe I finally
have this working the way I need it to. Just wondering if the gurus
(yes that's you Nate!) could confirm I got it done the right way. I am
quite excited by the richness of the 1.2 validation feature -- I'm
removing all the uglin
'rule' = '/^[1-9][0-9]*$/' // Start-(1 to 9) exactly one - ( 0 to 9 )
from none to any
'allowEmpty' => true
On Sun, Mar 9, 2008 at 10:16 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> On Sun, Mar 9, 2008 at 8:14 PM, b logica <[EMAIL PROTECTED]> wrote:
> > On Sun, Mar 9, 2008 at 12:31 PM, Deane <[E
On Sun, Mar 9, 2008 at 8:14 PM, b logica <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 9, 2008 at 12:31 PM, Deane <[EMAIL PROTECTED]> wrote:
> >
> > A field needs to either be (1) a valid number, or (2) nothing. So, in
> > effect, "You don't have to enter this, but if you do, it better be a
> >
On Sun, Mar 9, 2008 at 12:31 PM, Deane <[EMAIL PROTECTED]> wrote:
>
> This may be more of a regex question, but I can't seem to get some
> validation working inside Cake that seems to work fine outside of
> Cake.
>
> A field needs to either be (1) a valid number, or (2) nothing. So, in
> eff
This may be more of a regex question, but I can't seem to get some
validation working inside Cake that seems to work fine outside of
Cake.
A field needs to either be (1) a valid number, or (2) nothing. So, in
effect, "You don't have to enter this, but if you do, it better be a
number."
This...
In the manual I see a code snippet for custom validation in a case
when the application needs to validate that a username doesn't already
exist in the database.
This validation is written inline in the controller. Shouldn't custom
validation methods be handled on the model as well?
For example.
Sorry for not being more explicit but I figured that post had the info
you needed.
If I'm correct in assuming you just want to do what VALID_NOT_EMPTY
did, then this should work
var $validate = array('somefield' => array('rule' =>
array('minLength', 1)));
On Nov 13, 1:55 pm, mbavio <[EMAIL PROT
thanks for your answer theman, but minLenght is not the solve to this
problem...
I´ve solved myself with the help of the IRC (tks kabturek!)... You
cant put 'rule' => null and validate with 'required' and 'allowEmpty'.
Proved.
Thanks anyway. See u.
Martin Bavio
On Nov 13, 5:14 pm, theman <[EMA
minLength is the key...
see
http://groups.google.ca/group/cake-php/browse_thread/thread/786da77a8cdfb124/ae2f6c903a367aa4?lnk=gst&q=minlength#ae2f6c903a367aa4
On Nov 13, 1:08 pm, mbavio <[EMAIL PROTECTED]> wrote:
> Now I´ve been told in the IRC that using VALID_NOT_EMPTY is
> deprecated, so I
Now I´ve been told in the IRC that using VALID_NOT_EMPTY is
deprecated, so I have to use a validation array... The problem is that
I cant make just a NOT_EMPTY rule, because it doesn´t exist! Or it
does?
My problem...
'login' => array(
'rule' => 'ruleName',
'required'
Hi, I´m reading the Cake´s Manual of 1.2 Version and I have a doubt...
Are the followind ways of validate the same?
1)'login' => VALID_NOT_EMPTY,
2)'login' => array(
'rule' => 'ruleName',
'required' => true,
'allowEmpty' => false,
Could you post your validation set in the model ?
On Jul 16, 8:56 pm, R13ckJ <[EMAIL PROTECTED]> wrote:
> Take it I'm not the only one missing something huh?!
>
> On Jul 16, 1:50 pm, R13ckJ <[EMAIL PROTECTED]> wrote:
>
> > Can someone tell me why when I set multiple validation messages in my
> >
Take it I'm not the only one missing something huh?!
On Jul 16, 1:50 pm, R13ckJ <[EMAIL PROTECTED]> wrote:
> Can someone tell me why when I set multiple validation messages in my
> model in the view only the last validation message is available? Why
> does it get overwritten so the user can only
Can someone tell me why when I set multiple validation messages in my
model in the view only the last validation message is available? Why
does it get overwritten so the user can only correct one validation
error at a time? Surely I'm missing something!
--~--~-~--~~~-
Oh! that's right! didn't though of that :D
thanks, this is much more versatile.
On Jun 8, 2:37 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> I think you've just got your rule wrong - this looks like the expected
> result to me. Your test string does have valid characters in it...
>
> Do you want yo
I think you've just got your rule wrong - this looks like the expected
result to me. Your test string does have valid characters in it...
Do you want your rule to match strings which only have lowercase,
numeric, or space characters (no uppercase / other stuff)? In that
case you have to indicat
Hi all,
i had some problems with the validation mechanism in cake 1.2, so i
went right into the code.
i learned that there is something that don't work as it supposed to
work.
if i have a model with the member
var $validate = array(
'alias' => array(
86 matches
Mail list logo