Re: Strange validation issue

2012-03-20 Thread heohni
I tried 
'con_firstname' => array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyFirstName', 
'last' => true)
),
'con_lastname' => array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyLastName'),
'last' => true
),

but both is not working.

PS: Hi Mark, I am just about to get your captcha working with 2.0 but still 
have problem with it when doing the validation via ajax

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Strange validation issue

2012-03-20 Thread euromark
you forgot

 last => true

in your rules


Am Dienstag, 20. März 2012 15:19:57 UTC+1 schrieb heohni:
>
> Hi,
>
> I have some strange (to me) problems with the validation of my contact 
> form in Cake 2.1
>
> This is my model
>  class Contact extends AppModel {
> var $name = 'Contact';
> var $useTable = 'contacts';
> var $primaryKey = 'con_id';
>
> var $validate = array(
> 'con_firstname' => array(
> 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyFirstName')
> ),
> 'con_lastname' => array(
> 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyLastName')
> ),
> 'con_email' => array(
> 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail'),
> 'email' => array('rule' => array('email', true), 'message' => 
> 'SyntaxEmail')
> ),
> 'con_phone' => array(
> 'required' => array('rule' => 'notEmpty', 'message' => 'EmptyPhone')
> ),
> );
> }
>
> I do the validation via ajax.
> My controller is this:
>
> $this->Contact->set($this->data['Contact']);
>
> if($this->Contact->validates()) {
>   $message = __('Hurra! ');
>$data = $this->data;
> $this->set('success', compact('message'));
> }else{
>   $message = __('Oh no');
> $Contact = $this->Contact->invalidFields();
>$data = compact('Contact');
> $this->set('errors', compact('message', 'data'));
> }
>
> My index view returns the data as json but here comes the problem:
>
> if I do this: debug($this->validationErrors['Contact']); at the very first 
> beginning of my index view
>
> it returns me this array
>
> array
>   'con_firstname' => array(
>   (int) 0 => 'EmptyFirstName',
>   (int) 1 => 'EmptyFirstName'
>   ),
>   'con_email' => array(
>   (int) 0 => 'EmptyEmail',
>   (int) 1 => 'EmptyEmail'
>   )
> )
>
>
> How the hell I get the error twice here?
>
> The returned json look like this then
>
>  
> {"errors":{"data":{"Contact":{"con_firstname":["EmptyFirstName","EmptyFirstName"],"con_email":["EmptyEmail","EmptyEmail"]
>  
>
> Any ideas for me?
>

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Strange validation issue

2012-03-20 Thread heohni
Hi,

I have some strange (to me) problems with the validation of my contact form 
in Cake 2.1

This is my model
 array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyFirstName')
),
'con_lastname' => array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyLastName')
),
'con_email' => array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyEmail'),
'email' => array('rule' => array('email', true), 'message' => 'SyntaxEmail')
),
'con_phone' => array(
'required' => array('rule' => 'notEmpty', 'message' => 'EmptyPhone')
),
);
}

I do the validation via ajax.
My controller is this:

$this->Contact->set($this->data['Contact']);

if($this->Contact->validates()) {
  $message = __('Hurra! ');
   $data = $this->data;
$this->set('success', compact('message'));
}else{
  $message = __('Oh no');
$Contact = $this->Contact->invalidFields();
   $data = compact('Contact');
$this->set('errors', compact('message', 'data'));
}

My index view returns the data as json but here comes the problem:

if I do this: debug($this->validationErrors['Contact']); at the very first 
beginning of my index view

it returns me this array

array
'con_firstname' => array(
(int) 0 => 'EmptyFirstName',
(int) 1 => 'EmptyFirstName'
),
'con_email' => array(
(int) 0 => 'EmptyEmail',
(int) 1 => 'EmptyEmail'
)
)


How the hell I get the error twice here?

The returned json look like this then
 
{"errors":{"data":{"Contact":{"con_firstname":["EmptyFirstName","EmptyFirstName"],"con_email":["EmptyEmail","EmptyEmail"]
 

Any ideas for me?

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-16 Thread Davor Ilic
why you can´t see any question  hmm but i solved it...



2011/12/15 AD7six 

>
>
> On Dec 15, 4:51 pm, Davor Ilic  wrote:
> > yes im not a question ^^ . i do not register what you are talking about.
> > you said to me that i solved the question and i told you that i didn´t
> > solved it and then you ask me if i were a question xD sry but i can´t
> > understand what you want.
> >
> > next the question you will find when you follow the stackoverflow link
> > which i send in my first email
>
> There is no question in the link you posted.
> Your assumption that I had not read the link before 1st replying is
> incorrect.
> Cross-posting is pretty annoying.
>
> or in short: I want you to ask a specific question.
>
> AD
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread AD7six


On Dec 15, 4:51 pm, Davor Ilic  wrote:
> yes im not a question ^^ . i do not register what you are talking about.
> you said to me that i solved the question and i told you that i didn´t
> solved it and then you ask me if i were a question xD sry but i can´t
> understand what you want.
>
> next the question you will find when you follow the stackoverflow link
> which i send in my first email

There is no question in the link you posted.
Your assumption that I had not read the link before 1st replying is
incorrect.
Cross-posting is pretty annoying.

or in short: I want you to ask a specific question.

AD

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread Davor Ilic
yes im not a question ^^ . i do not register what you are talking about.
you said to me that i solved the question and i told you that i didn´t
solved it and then you ask me if i were a question xD sry but i can´t
understand what you want.

next the question you will find when you follow the stackoverflow link
which i send in my first email



2011/12/15 AD7six 

>
>
> On Dec 15, 4:20 pm, Davor Ilic  wrote:
> > no i´m ot
>
> you're not a question? neither is the text you stuck on SO
>
> AD
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread AD7six


On Dec 15, 4:20 pm, Davor Ilic  wrote:
> no i´m ot

you're not a question? neither is the text you stuck on SO

AD

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread Davor Ilic
no i´m ot

2011/12/15 AD7six 

>
>
> On Dec 15, 4:07 pm, Davor Ilic  wrote:
> > my question is in stackoverflow follow the link please
>
> I'm glad you solved your problem.
>
> AD
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread AD7six


On Dec 15, 4:07 pm, Davor Ilic  wrote:
> my question is in stackoverflow follow the link please

I'm glad you solved your problem.

AD

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread Davor Ilic
my question is in stackoverflow follow the link please

2011/12/15 AD7six 

>
>
> On Dec 15, 3:53 pm, Davor Ilic  wrote:
> > here i have descripe my problem could some help please.
> >
> > http://stackoverflow.com/q/8521936/1029693
>
> strpos($yourquestion, '?') === false.
>
> What's the question.
>
> AD
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: validation issue with model

2011-12-15 Thread AD7six


On Dec 15, 3:53 pm, Davor Ilic  wrote:
> here i have descripe my problem could some help please.
>
> http://stackoverflow.com/q/8521936/1029693

strpos($yourquestion, '?') === false.

What's the question.

AD

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


validation issue with model

2011-12-15 Thread Davor Ilic
here i have descripe my problem could some help please.

http://stackoverflow.com/q/8521936/1029693

thx

-- 
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, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validation Issue - Multiple rows / multiple models, One form

2008-09-05 Thread Leonardo

I have the same problem.

Any idea?

sorry my english.

On Aug 17, 5:22 pm, Donius <[EMAIL PROTECTED]> wrote:
> Thank you, but sadly not quite what i'm looking for.  I can get the
> validation to accept and reject successfully without issue.  My
> problem is that theformelements on the front end are not showing the
> validation errors when validation fails.  Any suggestions from anyone?
>
> On Aug 17, 8:08 am, Erhan Abay <[EMAIL PROTECTED]> wrote:
>
> > I sometimes use validation library as follows:
>
> >http://paste-it.net/public/a60b176/
>
> > The logic may help you.
>
> > On Aug 16, 5:49 pm, Donius <[EMAIL PROTECTED]> wrote:
>
> > > Hallo,
>
> > > I'm having some trouble understanding how to pass validation errors
> > > back to my view withtwoinstances oftwodifferent models on a single
> > >form.  I can do this pretty easily with one instance of eachmodelon
> > > the sameform- passing all of the data toModel->set and then
> > > checkingModel->validates seems to set the error data for the view
> > > (and theformhelper) to auto-output the validattion errors we
> > > encounter.  Yay!  Theformdata looks something like this when i do
> > > it:
>
> > > [Borrower][name] => "Bubba"
> > > [Borrower][email] => "[EMAIL PROTECTED]"
> > > [Address][city] => "Graceland"
> > > [Address][state] => "VA"
>
> > > This works and is great.  Swell.  However, when i try to enter in the
> > > next set so that the resultant data looks something like this:
>
> > > [Borrower][0][name] => "Bubba"
> > > [Borrower][0][email] => "[EMAIL PROTECTED]"
> > > [Address][0][city] => "Graceland"
> > > [Address][0][state] => "VA"
> > > [Borrower][1][name] => "White"
> > > [Borrower][1][email] => "[EMAIL PROTECTED]"
> > > [Address][1][city] => "Galveston"
> > > [Address][1][state] => "TX"
>
> > > I can still validate fine, but the errors don't seem to get back to
> > > theformhelper.  I'm not really sure what i'm doing wrong here.  I've
> > > googled and haven't found an example of something quite like this -
> > > can anyone shed some light or point me somewhere good?  Thanks!

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation Issue - Multiple rows / multiple models, One form

2008-08-17 Thread Donius

Thank you, but sadly not quite what i'm looking for.  I can get the
validation to accept and reject successfully without issue.  My
problem is that the form elements on the front end are not showing the
validation errors when validation fails.  Any suggestions from anyone?

On Aug 17, 8:08 am, Erhan Abay <[EMAIL PROTECTED]> wrote:
> I sometimes use validation library as follows:
>
> http://paste-it.net/public/a60b176/
>
> The logic may help you.
>
> On Aug 16, 5:49 pm, Donius <[EMAIL PROTECTED]> wrote:
>
> > Hallo,
>
> > I'm having some trouble understanding how to pass validation errors
> > back to my view with two instances of two different models on a single
> > form.  I can do this pretty easily with one instance of each model on
> > the same form - passing all of the data to Model->set and then
> > checking Model->validates seems to set the error data for the view
> > (and the form helper) to auto-output the validattion errors we
> > encounter.  Yay!  The form data looks something like this when i do
> > it:
>
> > [Borrower][name] => "Bubba"
> > [Borrower][email] => "[EMAIL PROTECTED]"
> > [Address][city] => "Graceland"
> > [Address][state] => "VA"
>
> > This works and is great.  Swell.  However, when i try to enter in the
> > next set so that the resultant data looks something like this:
>
> > [Borrower][0][name] => "Bubba"
> > [Borrower][0][email] => "[EMAIL PROTECTED]"
> > [Address][0][city] => "Graceland"
> > [Address][0][state] => "VA"
> > [Borrower][1][name] => "White"
> > [Borrower][1][email] => "[EMAIL PROTECTED]"
> > [Address][1][city] => "Galveston"
> > [Address][1][state] => "TX"
>
> > I can still validate fine, but the errors don't seem to get back to
> > the form helper.  I'm not really sure what i'm doing wrong here.  I've
> > googled and haven't found an example of something quite like this -
> > can anyone shed some light or point me somewhere good?  Thanks!

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: validation issue

2008-02-22 Thread Dardo Sordi Bogado

Define it in AppController::beforeFilter().

On Fri, Feb 22, 2008 at 5:47 AM, bhushan A <[EMAIL PROTECTED]> wrote:
>
>  Hi all
>
>  there is one variable set  as follows define('abc', 0.05); in
>  core.php. This value of abc is for users login. i want to make it 0.01
>  for admin login. how can i achieve this.
>  Please help
>
>  Bhushan
>  >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



validation issue

2008-02-21 Thread bhushan A

Hi all

there is one variable set  as follows define('abc', 0.05); in
core.php. This value of abc is for users login. i want to make it 0.01
for admin login. how can i achieve this.
Please help

Bhushan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---