No, I don't use isUnique validation rule. Here is my $validation
array:
var $validate=array(
'for_date'=>array('required'=>VALID_NOT_EMPTY,
'date'=>array('rule'=>array('date', 'ymd')),
'length'=>arr
What validation rules do you use? If there is isUnique, for example,
for each check it makes database query, result is saved in memory (if
cacheQueries is on) and query string is saved in SQL log (if debug is
2).
On Oct 13, 5:15 pm, senser wrote:
> Hello,
>
> I try to save a large
;true)), but even
with 1024MB memory limit, script fails. I've tried to save each record
with loop and $Model->save($data) instead of $Model->saveAll(), but
this makes no difference. Disabling validation makes the trick though.
When records are not validated script consumes (almost) consta
Your page has been saved.");
> $this->redirect(array("action" => "index"));
> }
> } else {
> $this->set("authors", $this->SimplePage->Author->find("list",
> array("fields" => array("disp
index"));
}
} else {
$this->set("authors", $this->SimplePage->Author-
>find("list", array("fields" => array("displayname";
$this->render("admin_edit");
}
}
Everything is
'required' key serves not existent fields, false by default.
var $validate = array(
'name' => array(
'notempty' => array(
'rule' => array('notempty'),
'required' => true // this rule wil
hello.
i have 2 models
Article hasMany Component
in my Component model i wrote a custom validation rule that relies on
data from Article model.
how can i get this data?
$this->Article->find doesn't work because that function loads data
from the database.. and i need the going-to-be
clearly doesn't seem to be able
>> to come even close to the experience of RoR. Any yes, I know CakePHP
>> isn't RoR, and yes, I could switch (well actually, I can't)... Just my
>> 2 c€nts...
>>
>>
>>
>> On Thu, Sep 30, 2010 at 2:58 PM
the experience of RoR. Any yes, I know CakePHP
> isn't RoR, and yes, I could switch (well actually, I can't)... Just my
> 2 c€nts...
>
>
>
> On Thu, Sep 30, 2010 at 2:58 PM, euromark wrote:
> > actually it is NOT a bug
> > although many are not aware of that
isn't RoR, and yes, I could switch (well actually, I can't)... Just my
2 c€nts...
On Thu, Sep 30, 2010 at 2:58 PM, euromark wrote:
> actually it is NOT a bug
> although many are not aware of that behavior :)
>
> you need to make sure that the field is passed to the vali
actually it is NOT a bug
although many are not aware of that behavior :)
you need to make sure that the field is passed to the validation
otherwise it will be ignored
@see http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
On 30 Sep., 14:52, psybear83 wrote:
> Hi everyb
Hi everybody
I have baked the following very straight-forward model:
class Post extends AppModel {
var $name = 'Post';
var $displayField = 'name';
var $validate = array(
'name' => array(
'notempty' => array(
that or create a separate function to search for an existing user
before adding instead of using cake's validation rules
On Sep 29, 1:00 pm, Anthony wrote:
> > It sounds like you are saving a record right? When you are done with
> > your $this->Model->save(), the id o
done. When a new player is saved the
> redirect takes you to the action that displays information about the
> single user based on the newly created ID.
>
>
>
> > Why would you want to redirect during validation? Validation is
> > generally for the saving and updating of
edirect takes you to the action that displays information about the
single user based on the newly created ID.
>
> Why would you want to redirect during validation? Validation is
> generally for the saving and updating of records, are you trying to
> interrupt that? Or am I misreading
It sounds like you are saving a record right? When you are done with
your $this->Model->save(), the id of the record will be in $this-
>Model->id and you can redirect from there in the controller.
Why would you want to redirect during validation? Validation is
generally for th
Each server has many players and players belong to a server.
Each player may have the same first and last name but only one per
server.
I have a custom validation that is working correctly when the form is
submitted.
My thoughts were to kill two birds with one stone and have the
validation
Hi,
can i somehow see *in a view* whether a forma validation error
occurred? Like:
if ($form->hasErrors() )
echo 'there was an error';
else
echo 'please edit the entry';
Or can i only check for that in the controller and have to pass a
variable to the view?
Ch
; doesn't really test its value. So in your case, required => true might
> > >> be enough.
>
> > >> Jeremy Burns
> > >> Class Outfit
>
> > >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > >> On 25 Sep 2010, a
s that the field must be present in the data array, and
> >> doesn't really test its value. So in your case, required => true might be
> >> enough.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.comhttp://www.classoutfi
assoutfit.comhttp://www.classoutfit.com
>
> >> On 25 Sep 2010, at 12:20, Mariano C. wrote:
>
> >>> Reading the doc there's explained that require isn't a "pure" rule, so
> >>> I'm asking how can I use it in multipl
t; On 25 Sep 2010, at 12:20, Mariano C. wrote:
>>
>>
>>
>>> Reading the doc there's explained that require isn't a "pure" rule, so
>>> I'm asking how can I use it in multiple validation per field case:
>>
>>> exampl
t; jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 25 Sep 2010, at 12:20, Mariano C. wrote:
>
>
>
> > Reading the doc there's explained that require isn't a "pure" rule, so
> > I'm asking how can I use it in
bu...@classoutfit.com
http://www.classoutfit.com
On 25 Sep 2010, at 12:20, Mariano C. wrote:
> Reading the doc there's explained that require isn't a "pure" rule, so
> I'm asking how can I use it in multiple validation per field case:
>
> example:
Reading the doc there's explained that require isn't a "pure" rule, so
I'm asking how can I use it in multiple validation per field case:
example:
var $validate = array
(
'id' => array(
'idRule-1&
fit
> > wrote:
> >> I have *really* solved it now. In my app_controller I had var
> >> $persistModel = true; which I was lead to believe was a *good thing* from
> >> a performance point of view. If I comment out that line my problem
> >> disappears and I
line my problem disappears and I
>> reliably get validation messages on screen.
>>
>> Before I leave this, can anyone shed any more light on this? Is this
>> behaviour correct, and what is the impact of leaving out persistModel?
>>
>> Jeremy Burns
>> Class Ou
*good thing* from a performance point
> of view. If I comment out that line my problem disappears and I reliably get
> validation messages on screen.
>
> Before I leave this, can anyone shed any more light on this? Is this
> behaviour correct, and what is the impact of lea
I have *really* solved it now. In my app_controller I had var $persistModel =
true; which I was lead to believe was a *good thing* from a performance point
of view. If I comment out that line my problem disappears and I reliably get
validation messages on screen.
Before I leave this, can
I jumped the gun. After I cleared the cache I resubmitted the form and got the
validation error messages. Deep joy. I closed the ticket and told the world my
problem was solved.
Then I resubmitted the form again - and no validation messages. This is
repeatable: clear the cache, submit the form
out and the code is not erroring
> before or after the saves; the saves are happening and failing, producing
> validation errors.
>
> I have created a variable ($validationErrors) and added the validationErrors
> as they occur (so at one point the array looks like
> $validati
g and failing, producing validation
errors.
I have created a variable ($validationErrors) and added the validationErrors as
they occur (so at one point the array looks like
$validationErrors['OrderAddress']['field_name'] => 'message').
I have added some deb
Output get_class($this->MyModelThatDontValidate) or call custom model
method to check that models are really loaded. Also check that you
approach save() or validates() call in controller and don't get error
before that abandon save/validation. Be sure that debug > 0. In most
of cases
ен, 20:52, Jeremy Burns wrote:
>> I'm a bit stumped. I've developed some code on my local machine (MAMP)
>> and when a form fails validation I get the right error messages
>> displayed in the right places. I have used the form helper to create
>> the form and the inputs,
99.9% - your models are not loaded at all because you named them not
in lowercase.
On 16 сен, 20:52, Jeremy Burns wrote:
> I'm a bit stumped. I've developed some code on my local machine (MAMP)
> and when a form fails validation I get the right error messages
> displayed in
I'm a bit stumped. I've developed some code on my local machine (MAMP)
and when a form fails validation I get the right error messages
displayed in the right places. I have used the form helper to create
the form and the inputs, but have not used any code to produce the
error messa
rmat is Day Month Year as
> in 1 Sep 2010 or 1-9-2010
> Programatically in SQL we use year-month-day hour:min:second.micro.
> 2010-09-01 12:00:00.123
> ISO 8601 2004-02-12T15:19:21+00:00
> As validation is for verifying data input we need to consider the
> mindset of the community t
ramatically in SQL we use year-month-day hour:min:second.micro.
> 2010-09-01 12:00:00.123
> ISO 8601 2004-02-12T15:19:21+00:00
> As validation is for verifying data input we need to consider the
> mindset of the community that will be using our software and provide
> the proper conversions from
as in 9-1-2010 this represents 9 Jan 2010.
All most everywhere else on the planet the format is Day Month Year as
in 1 Sep 2010 or 1-9-2010
Programatically in SQL we use year-month-day hour:min:second.micro.
2010-09-01 12:00:00.123
ISO 8601 2004-02-12T15:19:21+00:00
As validation is for verifying
parse_url()
and use its return values
On 14 Sep., 13:52, Andrei Mita wrote:
> You could use a couple of the string functions found
> here:http://php.net/manual/en/ref.strings.php
>
>
>
> On Tue, Sep 14, 2010 at 6:05 AM, Dave Maharaj wrote:
> > Anyone know how to strip everything from a url so
You could use a couple of the string functions found here:
http://php.net/manual/en/ref.strings.php
On Tue, Sep 14, 2010 at 6:05 AM, Dave Maharaj wrote:
> Anyone know how to strip everything from a url so your left with
> http://www.site.com ?
>
> So if user enters http://www.site.com/somethin
Anyone know how to strip everything from a url so your left with
http://www.site.com ?
So if user enters http://www.site.com/something or www.site.com/anything
So basically remove everything after the domain extension and add http: to
the www if it was left out.
Thanks,
Dave
Ch
[13579][26])|((16|[2468][048]|
[3579][26])00)))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/';
not recommended to mess with the core but it works.
On Aug 4, 5:03 pm, Brenda wrote:
> I have event_date in my model, with this validation rule:
>
> 'event_date' => arr
On Fri, Sep 10, 2010 at 7:34 PM, Lance wrote:
> Got it figured out! I kept using the debug(); function until my
> variable values made sense.
> I hope this helps people who are trying to validate against the
> database while editing a user.
> It makes sure the value isUnique. Just adjust the fie
#x27;], array('User.id' => $this->data['User']
> > > ['id'] )
> > > {
> > > $this->invalidate('username_unique');
> > > return false;
> > >
his->invalidate('username_unique');
> > return false;
> > }
> > return true;
> > }
>
> > On Sep 10, 12:23 pm, cricket wrote:
>
> > > On Fri, Sep 10, 2010 at 3:21 PM, cricket wrot
false;
> }
> return true;
> }
>
> On Sep 10, 12:23 pm, cricket wrote:
>
> > On Fri, Sep 10, 2010 at 3:21 PM, cricket wrote:
> > > On Fri, Sep 10, 2010 at 3:06 PM, Lance wrote:
> > >> I actually want to check isUniqu
Lance wrote:
> > >> I actually want to check isUnique if they edit their username or email
> > >> address.
> > >> I want it to check their changed username or email against the
> > >> database to make sure it already doesn't exist.
> > &
l
> >> address.
> >> I want it to check their changed username or email against the
> >> database to make sure it already doesn't exist.
> >> Sorry for the confusion. Thanks again!
>
> > My fault, I didn't read that carefully.
>
> > In t
ake sure it already doesn't exist.
>> Sorry for the confusion. Thanks again!
>
> My fault, I didn't read that carefully.
>
> In this case, you could create a validation method that fetches both
> the ID and the value of whichever column you're checking. If it ex
nks again!
My fault, I didn't read that carefully.
In this case, you could create a validation method that fetches both
the ID and the value of whichever column you're checking. If it exists
AND the ID is not the current model ID then return false.
During validation, you can check $this-
> > If I add isUnique in $validate array it always isUnique and will throw
> > an error. Any help would be greatly appreciated!
>
> Add 'on' => 'create' to the validation options. The rule will be
> ignored for existing records.
Check out the new Cak
dd isUnique in $validate array it always isUnique and will throw
> an error. Any help would be greatly appreciated!
Add 'on' => 'create' to the validation options. The rule will be
ignored for existing records.
Check out the new CakePHP Questions site http://cakeqs.or
I have a User model and I want to allow logged in users to edit their
username or email address if they would like. I just want the
username or email address that they've changed to check against the
database to make sure it's unique. I'm using a beforeValidate method
on the sign up process to ch
Thank you Sanza and Dr. Loboto
I've tried Sanza's example and it works.
I will try a Dr. Loboto example lately.
Thank you!!!
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 t
Or you can define your invalidate() function in app_model:
public function invalidate($field, $value = true) {
if (is_string($value)) {
return parent::invalidate($field, __($value));
}
else {
return parent::invalidate($field);
}
}
Or you can try not use messages in
Hi I don't know if can help you, but to manage translation of error
messages i use this system.
I think is much clean and simply:
I put the all declaration of validate array inside the constructor of
the model:
function __construct($id = false, $table = null, $ds = null){
Hi.
I have a problem with translation validation messages. seems it didn't
takes from view.
I have a validation rules for field, it looks like:
'looking_agegroup_to' => array(
'checkRange'=>array (
:
> Thanks for this useful hint, euromark!
>
> On Tue, Sep 7, 2010 at 5:04 PM, euromark wrote:
>> if would use !empty() !!!
>> because the fields can be empty strings and will still pass validation
>>
>>
>> On 7 Sep., 16:59, Joshua Muheim wrote:
>>> Thank
d value for dependent select
> > list option in controller.
> > So my question is, how can I display options in dependent select list
> > with correctly selected value if validation fails ?
>
> > What I'm thinking now is that I set a variable in controller when
>
Thanks for this useful hint, euromark!
On Tue, Sep 7, 2010 at 5:04 PM, euromark wrote:
> if would use !empty() !!!
> because the fields can be empty strings and will still pass validation
>
>
> On 7 Sep., 16:59, Joshua Muheim wrote:
>> Thank you! :-)
>>
>> On Tu
correctly selected value if validation fails ?
>
> What I'm thinking now is that I set a variable in controller when
> validation fails. This variable will be passed to jquery.(this creates
> another problem that I don't quite understand, which is passing
> variable fr
if would use !empty() !!!
because the fields can be empty strings and will still pass validation
On 7 Sep., 16:59, Joshua Muheim wrote:
> Thank you! :-)
>
> On Tue, Sep 7, 2010 at 3:12 PM, Jeremy Burns | Class Outfit
>
> wrote:
> > Here's an example:
Thank you! :-)
On Tue, Sep 7, 2010 at 3:12 PM, Jeremy Burns | Class Outfit
wrote:
> Here's an example:
> The validation rule is:
>
> 'phone_home' => array(
> 'hasOnePhone' => array(
> 'rule' => 'hasOnePhone',
>
Here's an example:
The validation rule is:
'phone_home' => array(
'hasOnePhone' => array(
'rule' => 'hasOnePhone',
&
Hi all
I'm seeing how to have many validation rules for one field everywhere,
but I couldn't figure out how to have on validation rule that depends
on many fields?!
I have a model with 3 fields. I want to check that at least one of
these fields has a value.
How can I achieve this?
Th
I think you misunderstood my question. What I'm talking about is if
the validation fails.
In controller I don't do any redirect if validation fails. It simply
sets errors variable to be passed to add view and the view is rendered
with previously entered values along with error messages.
Hi,
You need to look into the Auth component, validation has nothing to do
with it.
Validation is about accepting data for save in the database
Authenthication is about finding out who the user is
Authorization is about telling what actions may be executed.
So you want authentication and
On Sep 6, 11:40 am, amin wrote:
> Hi,
>
> Can u plz help me out, how to call validation for multiple actions of
> a controller
The action and validation are not dependent - related.
>
> E.g. a user controller, in user controller add, signup, forgot
> password .. etc a
Hi,
Can u plz help me out, how to call validation for multiple actions of
a controller
E.g. a user controller, in user controller add, signup, forgot
password .. etc are actions
now in model class User extends AppModel{
}
how to validate mentioned actions validation in User model
I have
Hi,
Can u plz help me out, how to call validation for multiple actions of
a controller
E.g. a user controller, in user controller add, signup, forgot
password .. etc are actions
now in model class User extends AppModel{
}
how to validate mentioned actions validation in User model
I have
Hey,
I had this problem too and I found out that the validation is only
activated when you call save().
You can also do it manually by calling validates() as mentioned here:
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller
Kind regards,
philn
On Sep 4, 7:09 pm, Simon wrote
urns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 3 Sep 2010, at 05:14, aveev wrote:
> Hi, I'm new to cakephp
> I'm trying to create an applicant add form with validation..
> If validation fails, it should return to the add page with previously
> entere
If you have your validation rules set up in the model, they will automatically
be triggered each time you do any save action against the model - that is,
unless you have changed something to prevent it. You don't need to call the
validate method at all. You can, however, do if ($this->M
Hello everyone,
I try to get validation working on a register-form in my application.
Because it did not work at all, I tried it on a very simple form with
only a username field (it's called 'gebruikersnaam' in the code
because i'm belgian).
I allready did var_dump on $
Hi,
Can u plz help me out, how to call validation for multiple actions of
a controller
E.g. a user controller, in user controller add, signup, forgot
password .. etc are actions
now in model class User extends AppModel{
}
how to validate mentioned actions validation in User model
I have
Hi, I'm new to cakephp
I'm trying to create an applicant add form with validation..
If validation fails, it should return to the add page with previously
entered values.
Here's the code snippet
//applicant controller
function add() {
$docTypes = $this->Docume
Thanks Sam. I think i'll settle on jquery validation. i hope cake
integrates jquery validation.
On Aug 28, 2:56 am, Sam wrote:
> In the past I've used ajax to send fields to the controller to
> validate as they are changed- it is a bit slower than full client-side
> validatio
In the past I've used ajax to send fields to the controller to
validate as they are changed- it is a bit slower than full client-side
validation but is way easier to maintain.
On Aug 27, 8:34 am, sanedevil wrote:
> ah! sorry. i wanted to ask regarding client-side form validation.
>
ah! sorry. i wanted to ask regarding client-side form validation.
apparently, this can't be done with cake. if it can be, please lemme
know how.
On Aug 27, 8:25 am, Jeremy Burns | Class Outfit
wrote:
> See:http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
>
> if
See: http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
if ($this->Model->validates()):
or, from within the model of the data you want to validate...
if ($this->validates()):
Jeremy Burns
Class Outfit
jeremybu...@classoutfit.com
http://www.classoutfit.com
On 26 Aug 2010, a
heya!
is there a way to validate the data before submission using Cake?
Thanks!
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
AFAIK, cake doesn't have this built in, however if you use InnoDB
mysql tables you can use Foreign Key Constraints, which should give
you what you want.
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
On Aug 23, 8:30 pm, rvandervort wrote:
> Sorry that should read "
Sorry that should read " 'Player' => array( 'Player' =>
'Player' "
On Aug 23, 9:15 pm, rvandervort wrote:
> I'm not sure why, but expected models related by belongsTo and hasMany
> to be "autovalidated".
>
> e.g.
>
> class Team extends AppModel {
> var $hasMany = array(
> 'Play
I'm not sure why, but expected models related by belongsTo and hasMany
to be "autovalidated".
e.g.
class Team extends AppModel {
var $hasMany = array(
'Player' => array( 'Player' => 'Item' , 'foreignKey' =>
'team_id' )
);
}
class Player extends AppModel {
var $belongsTo = array(
Thanks for this advice. Anyway... casting doesn't solve the problem
that 'null' sets me the column on the standard value.
What i do if p.e. the standard value of a column is 1.? Of course
i can check all fields in the beforeValidate function, but it should
be a little more flexible and working
ray(
> 'rule' => array('numeric'),
> //'message' => 'Your custom message here',
> 'allowEmpty' => true,
>
//'message' => 'Your custom message here',
'allowEmpty' => true,
//'required' => false,
//'last' => false, // Stop validation after
this r
I have an array of data that I want to validate. Like this:
$this->data['Model'][0]['field1']
$this->data['Model'][0]['field2']
$this->data['Model'][0]['field3']
$this->data['Model'][1]['field1']
$this->data['Model'][1]['field2']
$this->data['Model'][1]['field3']
$this->data['Model'][2]['field1']
Do you mean something like this?
http://milesj.me/blog/read/10/Displaying-Form-Errors-As-A-List-In-CakePHP
On Aug 15, 8:35 am, euromark wrote:
> if you bake your views/forms
> this should be done automatically
>
> IF you set up your model relations accordingly anyway
> maybe somethings wrong her
x27;Next');
And in my controller action for this view I have something like:
$this->Order->DeliveryContact->set($this->data['DeliveryContact']);
if ($this->Order->DeliveryContact->validates()) {
proceedToNextStep();
}
The validation errors are not being pul
if you bake your views/forms
this should be done automatically
IF you set up your model relations accordingly anyway
maybe somethings wrong here
you should post your code for details
On 15 Aug., 16:30, Petr Vytlačil wrote:
> Hi I will try to describe my problem better:
>
> I have database table
Make some deliberate input errors in your form, and then place this in your
Address model code:
die(debug($this->validationErrors));
This will show you the output of your validation errors array, and then you'll
know what values to extract and display.
Jeremy Burns
Class Outfit
Hi I will try to describe my problem better:
I have database tables addresses and user so i have two models User
and Address.
User haveone malingaddress (class Address) and billaddress (class
Address) this is definate in model User.
How is registration form where are inputs for information about u
Same here
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@googlegroups.com
To unsubscribe fro
what's meant of redirect this errors for concrete input or group
inputs ?
really I want to help you
Sorry , I can't understand what you want
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
Nobody know solution?
On 13 srp, 13:22, Petr Vytlačil wrote:
> Hi is any way how i can display input validation errors in different
> container input?
> For examle a have model address and user model has deliver and billing
> address sou a need in form for greate user account twic
Hi is any way how i can display input validation errors in different
container input?
For examle a have model address and user model has deliver and billing
address sou a need in form for greate user account twice inputs for
address.
$form->input(Deliveraddress.street);
$form->
7;CreditCard');
>
> > > $creditCard->set( $this->data );
>
> > > if ($creditCard->validates($this->data['CreditCard'])):
>
> > > $this->Session->write('creditCard',
> > >
creditCard',
> > array(
> > 'card_type' =>
> > $this->data['CreditCard']['card_type'],
> > 'card_number' =>
> > $this->data[&
601 - 700 of 2727 matches
Mail list logo