I'm working on validation between two model model1 hasMany model2. I
have a two step process where in the end users first view they need to
enter a subset of data for both model1 2. Once this is complete,
they're then allowed to complete the entire process which includes
additional data for each
Here are my model rules..
'tin' = array(
//removed because not alll providers will have TIN
'notempty' = array(
'rule' = array('notempty'),
'message' = 'Please provide
The answer I found was...
no need for allowEmpty or required in notempty rule (that I can see).
Have to do the following to get both models to validate:
$this-Model1-set($this-data)
$this-Model1-Model2-set($this-data) // I would think this line is
all that would be needed, but you need both set
no problem .. you had already worked out the issue for yourself in
your 2nd post.
I just thought having someone else's code available to see how they
have got around the creation and editing of users and the difficulties
hashed passwords can cause would have been of some help :)
Hi everyone,
All help is greatly appreciated.
I am having trouble with my form validation, basically the notEmpty
rule is working perfectly with my username field, but not the password
field. Here is my validation array
var $validate = array(
'username' = array(
Ok, of course right after I posted this I had a bit of enlightenment:
basically I am pretty sure this is occuring because Cake Automagically
hashes the password field when it is being submitted. As you can see I
handle this in my comparePassword method.
I am guessing that the blank value is
Thanks for the response paul
while I will be definitley using some of your code to further improve mine,
my main issue was that notEmpty was not working for the password field
because Auth automagically hashes it. I have no problem with comparing the
two hashed passwords.
I will try with your
This is driving me crazy.
User Model:
var $validate = array(
'username' = array(
'usernameRule-1' = array(
'rule' = array(
'notEmpty'),
'message' = 'Please choose a Username',
I got it working.
Dave
-Original Message-
From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com]
Sent: October-19-09 2:16 PM
To: cake-php@googlegroups.com
Subject: Validation Help - All code Included
This is driving me crazy.
User Model:
var $validate = array
I am finally getting around to implementing the validation rules but seem to
be not quite understanding it or something.
I have this set up to validate Username:
'username' = array(
'user-notempty' = array(
'rule' = array(
'minLenght',
Hi Dave, you might check your spelling real quick: minLenght should be
minLength. That's probably why your length validation is always
passing.
On Sep 15, 8:30 am, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
I am finally getting around to implementing the validation rules but seem
Good looking out! Thanks man.
It all looks the same when you stare at it for hours. Fresh eye.
Thanks,
Dave
-Original Message-
From: mikeottinger [mailto:mikeottin...@gmail.com]
Sent: September-15-09 1:32 PM
To: CakePHP
Subject: Re: Validation Help
Hi Dave, you might check your
Not getting any validation error message with this:
'current' = array(
'rule' = array(
'between', 5, 15),
'required' = true,
'allowEmpty' = false,
'message' = 'Passwords must be between 5 and 15 characters long.',
'last' = true),
The
Hi Dave,
On the assumption, that all the possible values from the checkboxes,
can be found in the database, I would consider using:
http://book.cakephp.org/view/152/Adding-your-own-Validation-Methods
and in the validation method, validate that the submitted checkbox
values exists in the
the error message all set up.
Thanks again.
Dave
-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com]
Sent: June-12-09 3:50 AM
To: CakePHP
Subject: Re: Multiple Checkbox Validation help
Hi Dave,
On the assumption, that all the possible values from the checkboxes
I am trying to validate multiple checkboxes of a HABTM table. I managed to
validate the values but cannot get a message to display. I have my own
compare values in db against submitted data to validate but no message
appears
I then see in the cookbook
var $validate = array(
I think it should be:
?php
class Category extends AppModel
{
var $name = 'Category';
var $validate = array(
'category' = array(
'rule' = 'alphaNumeric',
'required' = true,
'allowEmpty'=false
)
);
}
?
On Thu, May 7, 2009 at 7:57 AM, Dr. Loboto
arif's sugggestion didn't work either
Dr. Loboto I'm not sure how that will help since the data is saving to
the database correctly. When I put in an empty field it saves the
empty field instead of outputting an error message. When I put in a
category name it saves it.
Gwoo #2: But the data
I think I figured it out I had my model file named wrong.
yep that was the problem thanks for the help.
On May 7, 8:16 am, matalina matal...@gmail.com wrote:
arif's sugggestion didn't work either
Dr. Loboto I'm not sure how that will help since the data is saving to
the database correctly.
I followed along with the blog tutorial and got that working with out
a problem. Now I'm modifying the blog tutorial for my own purposes
since the basic technique was the same for this particular part of the
project but now the fields are not validating. When I had it as
notEmpty it still
I have tried various combinations for validation still nothing is
working.
This is my last attempt and it's still not validating an empty field,
I still get an empty database value (new id no content - instead of an
error message)
?php
class Category extends AppModel
{
var $name =
Are you sure that cake is finding your model? pr($this-Category);
inside your controller. If you see an AppModel instance rather than a
Category instance then you know cake is unable to find the model.
Also, make sure that the form input is correctly sending the fields
you are expecting. If you
Output $this-data in controller and check actual data you try to
save.
On May 7, 5:35 am, matalina matal...@gmail.com wrote:
I have tried various combinations for validation still nothing is
working.
This is my last attempt and it's still not validating an empty field,
I still get an empty
Ok, so i've been experimenting with model validation. It all seems
very cool, except I am seeing some holes.
From the tutorial this is what I have in the controller:
http://bin.cakephp.org/view/2080892837
Problem:
What if data is sent through that should NOT be stored in table? How
do I stop
Hi Jonah,
Problem:
What if data is sent through that should NOT be stored in table? How
do I stop that? For example, say I had a column named
do_not_store_data_here in the table. For some reason I do not want
any data stored there. I can't think of any particular cases where I
would
Thank you! That was exactally what I was looking for. That should
work nicely.
Still looking for the answer to this question though:
Also, does cakephp take care of mysql injection checking automagically
or do I have to call mysql_real_escape_string for everything
manually? Or is there
All of the various database frontends are in cake/libs/model/datasources/dbo/
On Fri, Jun 6, 2008 at 4:18 PM, Turnquist, Jonah [EMAIL PROTECTED] wrote:
Thank you! That was exactally what I was looking for. That should
work nicely.
Still looking for the answer to this question though:
If you are using cakephp and publish websites to the internet, you
should very well know if it is secure. My question is do I have to do
something to the data before saving it to the database manually to
keep it mysql injection safe or does cake take care of that?
For instance do I need to use
Huh? Is it too difficult to open the file and search for the word 'escape'?
I agree that Cake's inner workings are bloody mysterious, but if
you're using PHP--period--you should very well know how to search a
file for a method.
On Fri, Jun 6, 2008 at 10:31 PM, Turnquist, Jonah [EMAIL PROTECTED]
Looking back over my last reply I think I might have sounded a bit
rude, sorry about that
I did the search as you said and found one instance of the function,
but was not able to make sense of it. I did do some googling and
found this page though: http://grahambird.co.uk/cake/
quote from page:
30 matches
Mail list logo