Re: CakePHP-3 Plugins form validation messages and field values

2015-02-23 Thread Gaurav Kumar
Lorenzo,

I got the problem and the solution both. The problem was happening because 
of page reload. So now with the help of session i can fix that or I got 
modelless forms in cakephp which is also providing the solution. thanks for 
you help.

On Monday, February 23, 2015 at 1:57:41 PM UTC+5:30, José Lorenzo wrote:
>
> Can you show the code you are using? Use gist.github.com to show your 
> table class, controller and form code.
>
> On Thursday, February 19, 2015 at 7:19:22 AM UTC+1, Gaurav Kumar wrote:
>>
>> I have just created a CommentManager plugin. Created the comment form in 
>> post's view.ctp file and able to add the comments. But when the values of 
>> the comment form are wrong(email format is not proper or empty) then i am 
>> not getting the validation message in front of the respected fields and the 
>> values are not refilled.
>>
>> Also would like to know what would be the proper way to create a comment 
>> form inside a view file of posts.
>>
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CakePHP-3 Plugins form validation messages and field values

2015-02-23 Thread José Lorenzo
Can you show the code you are using? Use gist.github.com to show your table 
class, controller and form code.

On Thursday, February 19, 2015 at 7:19:22 AM UTC+1, Gaurav Kumar wrote:
>
> I have just created a CommentManager plugin. Created the comment form in 
> post's view.ctp file and able to add the comments. But when the values of 
> the comment form are wrong(email format is not proper or empty) then i am 
> not getting the validation message in front of the respected fields and the 
> values are not refilled.
>
> Also would like to know what would be the proper way to create a comment 
> form inside a view file of posts.
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP-3 Plugins form validation messages and field values

2015-02-19 Thread Gaurav Kumar
I have just created a CommentManager plugin. Created the comment form in 
post's view.ctp file and able to add the comments. But when the values of 
the comment form are wrong(email format is not proper or empty) then i am 
not getting the validation message in front of the respected fields and the 
values are not refilled.

Also would like to know what would be the proper way to create a comment 
form inside a view file of posts.

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Display Form Validation Errors CakePHP 3

2014-07-30 Thread José Lorenzo
Glad it worked :)

On Wednesday, July 30, 2014 3:35:21 PM UTC+2, Jipson Thomas wrote:
>
> Hi Jose Lorenzo,
> Thank you very much. Now it is working perfectly.
> Regards,
> Jipson
>
> On Wednesday, 30 July 2014 14:31:30 UTC+1, José Lorenzo wrote:
>>
>> Ok, you problem is that you are calling create() without the entity, You 
>> should get that fixed by doing:
>>
>> Form->create($package) ?>
>>
>> On Wednesday, July 30, 2014 3:29:33 PM UTC+2, Jipson Thomas wrote:
>>>
>>> Hi Jose Lorenzo,
>>> Thank you for the reply. Please find the below code 
>>>
>>> *CTP*
>>> ==
>>> 
>>> Flash->render('auth') ?>
>>> Form->create() ?>
>>> 
>>> >> ?>
>>>Form->input('name', ['label' => 'Package 
>>> Name']); ?>
>>>Form->input('annual_price', ['label' => 'Price 
>>> / Year','type' => 'decimal']); ?>
>>>Form->input('monthly_price', ['label' => 'Price 
>>> / Month','type' => 'decimal']); ?>
>>>Form->input('duration', ['label' => 'Minimum 
>>> Months of Contract','type' => 'integer']);?>
>>>Form->input('no_partners', ['label' => 'Maximum 
>>> No of Partners','type' => 'integer']);?>
>>>Form->input('no_emails', ['label' => 'Maximum 
>>> No of Emails/Month','type' => 'integer']);?>
>>>Form->input('storage', ['label' => 'Maximum 
>>> Allowed Storage Space (GB)','type' => 'integer']);?>
>>>Form->input('resource_library', ['label' => 
>>> 'Resource Library','type' => 'checkbox','value' => 'Y','hiddenField' => 
>>> 'N']);?> 
>>>Form->input('portal_cms', ['label' => 'Portal 
>>> CMS','type' => 'checkbox','value'=>'Y','hiddenField' => 'N']);?>
>>>Form->input('MDF', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>>Form->input('deal_registration', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>>Form->input('partner_recruit', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>>Form->input('training', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>>Form->input('Socialmedia', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>>Form->input('multilingual', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>>Form->input('partner_incentive', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>>Form->input('partner_app', ['type' => 
>>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>>
>>> 
>>> Form->button(__('Save')); ?>
>>> Form->end() ?>
>>> 
>>>
>>> *Controller Action*
>>> ==
>>> public function add(){
>>> $package = $this->Package->newEntity($this->request->data);
>>> if ($this->request->is('post')) {
>>> if ($this->Package->save($package)) {
>>> $this->Flash->success(__('The package has been saved.'));
>>> return $this->redirect(['action' => 'index']);
>>> }
>>> else{
>>>   //  $errors = $this->Package->errors();
>>> 
>>> $error_string=  implode('\n',$package->errors());
>>> //print_r($package);
>>> }
>>> $this->Flash->error(__('Unable to add the package.'));
>>> }
>>> $this->set('package', $package);
>>> }
>>>
>>> *Model - Table Class*
>>> =
>>> class PackagesTable extends Table {
>>> public function initialize(array $config) {
>>> $this->addBehavior('Timestamp', [
>>> 'events' => [
>>> 'Model.beforeSave' => [
>>> 'created_on' => 'new',
>>> 'modified_on' => 'always',
>>> ]
>>> 
>>> ]
>>> ]);
>>> }
>>> public function validationDefault(Validator $validator) {
>>> $validator
>>> ->notEmpty('name','A valid package name is required')
>>> ->notEmpty('annual_price','A valid annual price is required')
>>> ->notEmpty('monthly_price','A valid monthly price is 
>>> required')
>>> ->notEmpty('duration','Minimum duration of contract is 
>>> required')
>>> ->notEmpty('no_partners','Maximum no of partners is 
>>> required')
>>> ->notEmpty('no_emails','Maximum no of emails per month is 
>>> required');
>>>
>>> return $validator;
>>> }
>>> }
>>>
>>> Regards,
>>> Jipson
>>>
>>> On Wednesday, 30 July 2014 14:20:54 UTC+1, Jipson Thomas wrote:

 Hi ,
 On my package creation form I am using cakephp validation. The 
 validation is working perfectly. Unfortunately the validation error 
 messages are not displaying on my form. Would you please help me on this?

 The code I am using is as follows. Please advise me what I am missing 
 here.

 *My Table Class*
 ==
 public function validationDefault(Validator $validator) {
 $validator

Re: Display Form Validation Errors CakePHP 3

2014-07-30 Thread Jipson Thomas
Hi Jose Lorenzo,
Thank you very much. Now it is working perfectly.
Regards,
Jipson

On Wednesday, 30 July 2014 14:31:30 UTC+1, José Lorenzo wrote:
>
> Ok, you problem is that you are calling create() without the entity, You 
> should get that fixed by doing:
>
> Form->create($package) ?>
>
> On Wednesday, July 30, 2014 3:29:33 PM UTC+2, Jipson Thomas wrote:
>>
>> Hi Jose Lorenzo,
>> Thank you for the reply. Please find the below code 
>>
>> *CTP*
>> ==
>> 
>> Flash->render('auth') ?>
>> Form->create() ?>
>> 
>> > ?>
>>Form->input('name', ['label' => 'Package 
>> Name']); ?>
>>Form->input('annual_price', ['label' => 'Price / 
>> Year','type' => 'decimal']); ?>
>>Form->input('monthly_price', ['label' => 'Price 
>> / Month','type' => 'decimal']); ?>
>>Form->input('duration', ['label' => 'Minimum 
>> Months of Contract','type' => 'integer']);?>
>>Form->input('no_partners', ['label' => 'Maximum 
>> No of Partners','type' => 'integer']);?>
>>Form->input('no_emails', ['label' => 'Maximum No 
>> of Emails/Month','type' => 'integer']);?>
>>Form->input('storage', ['label' => 'Maximum 
>> Allowed Storage Space (GB)','type' => 'integer']);?>
>>Form->input('resource_library', ['label' => 
>> 'Resource Library','type' => 'checkbox','value' => 'Y','hiddenField' => 
>> 'N']);?> 
>>Form->input('portal_cms', ['label' => 'Portal 
>> CMS','type' => 'checkbox','value'=>'Y','hiddenField' => 'N']);?>
>>Form->input('MDF', ['type' => 'checkbox','value' 
>> => 'Y','hiddenField' => 'N']);?>
>>Form->input('deal_registration', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>Form->input('partner_recruit', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>Form->input('training', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>Form->input('Socialmedia', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>>Form->input('multilingual', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>Form->input('partner_incentive', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>Form->input('partner_app', ['type' => 
>> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>>
>> 
>> Form->button(__('Save')); ?>
>> Form->end() ?>
>> 
>>
>> *Controller Action*
>> ==
>> public function add(){
>> $package = $this->Package->newEntity($this->request->data);
>> if ($this->request->is('post')) {
>> if ($this->Package->save($package)) {
>> $this->Flash->success(__('The package has been saved.'));
>> return $this->redirect(['action' => 'index']);
>> }
>> else{
>>   //  $errors = $this->Package->errors();
>> 
>> $error_string=  implode('\n',$package->errors());
>> //print_r($package);
>> }
>> $this->Flash->error(__('Unable to add the package.'));
>> }
>> $this->set('package', $package);
>> }
>>
>> *Model - Table Class*
>> =
>> class PackagesTable extends Table {
>> public function initialize(array $config) {
>> $this->addBehavior('Timestamp', [
>> 'events' => [
>> 'Model.beforeSave' => [
>> 'created_on' => 'new',
>> 'modified_on' => 'always',
>> ]
>> 
>> ]
>> ]);
>> }
>> public function validationDefault(Validator $validator) {
>> $validator
>> ->notEmpty('name','A valid package name is required')
>> ->notEmpty('annual_price','A valid annual price is required')
>> ->notEmpty('monthly_price','A valid monthly price is 
>> required')
>> ->notEmpty('duration','Minimum duration of contract is 
>> required')
>> ->notEmpty('no_partners','Maximum no of partners is required')
>> ->notEmpty('no_emails','Maximum no of emails per month is 
>> required');
>>
>> return $validator;
>> }
>> }
>>
>> Regards,
>> Jipson
>>
>> On Wednesday, 30 July 2014 14:20:54 UTC+1, Jipson Thomas wrote:
>>>
>>> Hi ,
>>> On my package creation form I am using cakephp validation. The 
>>> validation is working perfectly. Unfortunately the validation error 
>>> messages are not displaying on my form. Would you please help me on this?
>>>
>>> The code I am using is as follows. Please advise me what I am missing 
>>> here.
>>>
>>> *My Table Class*
>>> ==
>>> public function validationDefault(Validator $validator) {
>>> $validator
>>> ->notEmpty('name','A valid package name is required')
>>> ->notEmpty('annual_price','A valid annual price is required')
>>> ->notEmpty('monthly_price','A valid monthly price is 
>>> required')
>>>   

Re: Display Form Validation Errors CakePHP 3

2014-07-30 Thread José Lorenzo
Ok, you problem is that you are calling create() without the entity, You 
should get that fixed by doing:

Form->create($package) ?>

On Wednesday, July 30, 2014 3:29:33 PM UTC+2, Jipson Thomas wrote:
>
> Hi Jose Lorenzo,
> Thank you for the reply. Please find the below code 
>
> *CTP*
> ==
> 
> Flash->render('auth') ?>
> Form->create() ?>
> 
>  ?>
>Form->input('name', ['label' => 'Package Name']); 
> ?>
>Form->input('annual_price', ['label' => 'Price / 
> Year','type' => 'decimal']); ?>
>Form->input('monthly_price', ['label' => 'Price / 
> Month','type' => 'decimal']); ?>
>Form->input('duration', ['label' => 'Minimum 
> Months of Contract','type' => 'integer']);?>
>Form->input('no_partners', ['label' => 'Maximum 
> No of Partners','type' => 'integer']);?>
>Form->input('no_emails', ['label' => 'Maximum No 
> of Emails/Month','type' => 'integer']);?>
>Form->input('storage', ['label' => 'Maximum 
> Allowed Storage Space (GB)','type' => 'integer']);?>
>Form->input('resource_library', ['label' => 
> 'Resource Library','type' => 'checkbox','value' => 'Y','hiddenField' => 
> 'N']);?> 
>Form->input('portal_cms', ['label' => 'Portal 
> CMS','type' => 'checkbox','value'=>'Y','hiddenField' => 'N']);?>
>Form->input('MDF', ['type' => 'checkbox','value' 
> => 'Y','hiddenField' => 'N']);?>
>Form->input('deal_registration', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>Form->input('partner_recruit', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>Form->input('training', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>Form->input('Socialmedia', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
>Form->input('multilingual', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>Form->input('partner_incentive', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>Form->input('partner_app', ['type' => 
> 'checkbox','value' => 'Y','hiddenField' => 'N']);?>
>
> 
> Form->button(__('Save')); ?>
> Form->end() ?>
> 
>
> *Controller Action*
> ==
> public function add(){
> $package = $this->Package->newEntity($this->request->data);
> if ($this->request->is('post')) {
> if ($this->Package->save($package)) {
> $this->Flash->success(__('The package has been saved.'));
> return $this->redirect(['action' => 'index']);
> }
> else{
>   //  $errors = $this->Package->errors();
> 
> $error_string=  implode('\n',$package->errors());
> //print_r($package);
> }
> $this->Flash->error(__('Unable to add the package.'));
> }
> $this->set('package', $package);
> }
>
> *Model - Table Class*
> =
> class PackagesTable extends Table {
> public function initialize(array $config) {
> $this->addBehavior('Timestamp', [
> 'events' => [
> 'Model.beforeSave' => [
> 'created_on' => 'new',
> 'modified_on' => 'always',
> ]
> 
> ]
> ]);
> }
> public function validationDefault(Validator $validator) {
> $validator
> ->notEmpty('name','A valid package name is required')
> ->notEmpty('annual_price','A valid annual price is required')
> ->notEmpty('monthly_price','A valid monthly price is required')
> ->notEmpty('duration','Minimum duration of contract is 
> required')
> ->notEmpty('no_partners','Maximum no of partners is required')
> ->notEmpty('no_emails','Maximum no of emails per month is 
> required');
>
> return $validator;
> }
> }
>
> Regards,
> Jipson
>
> On Wednesday, 30 July 2014 14:20:54 UTC+1, Jipson Thomas wrote:
>>
>> Hi ,
>> On my package creation form I am using cakephp validation. The validation 
>> is working perfectly. Unfortunately the validation error messages are not 
>> displaying on my form. Would you please help me on this?
>>
>> The code I am using is as follows. Please advise me what I am missing 
>> here.
>>
>> *My Table Class*
>> ==
>> public function validationDefault(Validator $validator) {
>> $validator
>> ->notEmpty('name','A valid package name is required')
>> ->notEmpty('annual_price','A valid annual price is required')
>> ->notEmpty('monthly_price','A valid monthly price is 
>> required')
>> ->notEmpty('duration','Minimum duration of contract is 
>> required')
>> ->notEmpty('no_partners','Maximum no of partners is required')
>> ->notEmpty('no_emails','Maximum no of emails per month is 
>> required');
>>
>> return $validator;
>> }
>>

Re: Display Form Validation Errors CakePHP 3

2014-07-30 Thread Jipson Thomas
Hi Jose Lorenzo,
Thank you for the reply. Please find the below code 

*CTP*
==

Flash->render('auth') ?>
Form->create() ?>


   Form->input('name', ['label' => 'Package Name']); 
?>
   Form->input('annual_price', ['label' => 'Price / 
Year','type' => 'decimal']); ?>
   Form->input('monthly_price', ['label' => 'Price / 
Month','type' => 'decimal']); ?>
   Form->input('duration', ['label' => 'Minimum 
Months of Contract','type' => 'integer']);?>
   Form->input('no_partners', ['label' => 'Maximum No 
of Partners','type' => 'integer']);?>
   Form->input('no_emails', ['label' => 'Maximum No 
of Emails/Month','type' => 'integer']);?>
   Form->input('storage', ['label' => 'Maximum 
Allowed Storage Space (GB)','type' => 'integer']);?>
   Form->input('resource_library', ['label' => 
'Resource Library','type' => 'checkbox','value' => 'Y','hiddenField' => 
'N']);?> 
   Form->input('portal_cms', ['label' => 'Portal 
CMS','type' => 'checkbox','value'=>'Y','hiddenField' => 'N']);?>
   Form->input('MDF', ['type' => 'checkbox','value' 
=> 'Y','hiddenField' => 'N']);?>
   Form->input('deal_registration', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
   Form->input('partner_recruit', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
   Form->input('training', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?>
   Form->input('Socialmedia', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?> 
   Form->input('multilingual', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?>
   Form->input('partner_incentive', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?>
   Form->input('partner_app', ['type' => 
'checkbox','value' => 'Y','hiddenField' => 'N']);?>
   

Form->button(__('Save')); ?>
Form->end() ?>


*Controller Action*
==
public function add(){
$package = $this->Package->newEntity($this->request->data);
if ($this->request->is('post')) {
if ($this->Package->save($package)) {
$this->Flash->success(__('The package has been saved.'));
return $this->redirect(['action' => 'index']);
}
else{
  //  $errors = $this->Package->errors();

$error_string=  implode('\n',$package->errors());
//print_r($package);
}
$this->Flash->error(__('Unable to add the package.'));
}
$this->set('package', $package);
}

*Model - Table Class*
=
class PackagesTable extends Table {
public function initialize(array $config) {
$this->addBehavior('Timestamp', [
'events' => [
'Model.beforeSave' => [
'created_on' => 'new',
'modified_on' => 'always',
]

]
]);
}
public function validationDefault(Validator $validator) {
$validator
->notEmpty('name','A valid package name is required')
->notEmpty('annual_price','A valid annual price is required')
->notEmpty('monthly_price','A valid monthly price is required')
->notEmpty('duration','Minimum duration of contract is 
required')
->notEmpty('no_partners','Maximum no of partners is required')
->notEmpty('no_emails','Maximum no of emails per month is 
required');

return $validator;
}
}

Regards,
Jipson

On Wednesday, 30 July 2014 14:20:54 UTC+1, Jipson Thomas wrote:
>
> Hi ,
> On my package creation form I am using cakephp validation. The validation 
> is working perfectly. Unfortunately the validation error messages are not 
> displaying on my form. Would you please help me on this?
>
> The code I am using is as follows. Please advise me what I am missing here.
>
> *My Table Class*
> ==
> public function validationDefault(Validator $validator) {
> $validator
> ->notEmpty('name','A valid package name is required')
> ->notEmpty('annual_price','A valid annual price is required')
> ->notEmpty('monthly_price','A valid monthly price is required')
> ->notEmpty('duration','Minimum duration of contract is 
> required')
> ->notEmpty('no_partners','Maximum no of partners is required')
> ->notEmpty('no_emails','Maximum no of emails per month is 
> required');
>
> return $validator;
> }
>
> *On my controller*
> 
> I am using the following codes to get the validation result.
> $package = $this->Package->newEntity($this->request->data);
> if ($this->SubscriptionPackage->save($package)) {
> $this->Flash->success(__('The package has been saved.'));
> return $this->redirect(['action' => 'index']);
> }
> else{
> //print_r($package->errors()); It will disp

Re: Display Form Validation Errors CakePHP 3

2014-07-30 Thread José Lorenzo
There does not seem to be any Form->create() call in that code you pasted. 
Can you share the full code?

On Wednesday, July 30, 2014 3:20:54 PM UTC+2, Jipson Thomas wrote:
>
> Hi ,
> On my package creation form I am using cakephp validation. The validation 
> is working perfectly. Unfortunately the validation error messages are not 
> displaying on my form. Would you please help me on this?
>
> The code I am using is as follows. Please advise me what I am missing here.
>
> *My Table Class*
> ==
> public function validationDefault(Validator $validator) {
> $validator
> ->notEmpty('name','A valid package name is required')
> ->notEmpty('annual_price','A valid annual price is required')
> ->notEmpty('monthly_price','A valid monthly price is required')
> ->notEmpty('duration','Minimum duration of contract is 
> required')
> ->notEmpty('no_partners','Maximum no of partners is required')
> ->notEmpty('no_emails','Maximum no of emails per month is 
> required');
>
> return $validator;
> }
>
> *On my controller*
> 
> I am using the following codes to get the validation result.
> $package = $this->Package->newEntity($this->request->data);
> if ($this->SubscriptionPackage->save($package)) {
> $this->Flash->success(__('The package has been saved.'));
> return $this->redirect(['action' => 'index']);
> }
> else{
> //print_r($package->errors()); It will display an array with field names 
> and message.
> }
>
> *On my ctp file I am using the following code.*
> 
>  Form->input('name', ['label' => 'Package Name']); ?>
>Form->input('annual_price', ['label' => 'Price / 
> Year','type' => 'decimal']); ?>
>Form->input('monthly_price', ['label' => 'Price / 
> Month','type' => 'decimal']); ?>
>Form->input('duration', ['label' => 'Minimum 
> Months of Contract','type' => 'integer']);?>
>Form->input('no_partners', ['label' => 'Maximum 
> No of Partners','type' => 'integer']);?>
>Form->input('no_emails', ['label' => 'Maximum No 
> of Emails/Month','type' => 'integer']);?>
>Form->input('storage', ['label' => 'Maximum 
> Allowed Storage Space (GB)','type' =>?>
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Display Form Validation Errors CakePHP 3

2014-07-30 Thread Jipson Thomas
Hi ,
On my package creation form I am using cakephp validation. The validation 
is working perfectly. Unfortunately the validation error messages are not 
displaying on my form. Would you please help me on this?

The code I am using is as follows. Please advise me what I am missing here.

*My Table Class*
==
public function validationDefault(Validator $validator) {
$validator
->notEmpty('name','A valid package name is required')
->notEmpty('annual_price','A valid annual price is required')
->notEmpty('monthly_price','A valid monthly price is required')
->notEmpty('duration','Minimum duration of contract is 
required')
->notEmpty('no_partners','Maximum no of partners is required')
->notEmpty('no_emails','Maximum no of emails per month is 
required');

return $validator;
}

*On my controller*

I am using the following codes to get the validation result.
$package = $this->Package->newEntity($this->request->data);
if ($this->SubscriptionPackage->save($package)) {
$this->Flash->success(__('The package has been saved.'));
return $this->redirect(['action' => 'index']);
}
else{
//print_r($package->errors()); It will display an array with field names 
and message.
}

*On my ctp file I am using the following code.*

 Form->input('name', ['label' => 'Package Name']); ?>
   Form->input('annual_price', ['label' => 'Price / 
Year','type' => 'decimal']); ?>
   Form->input('monthly_price', ['label' => 'Price / 
Month','type' => 'decimal']); ?>
   Form->input('duration', ['label' => 'Minimum 
Months of Contract','type' => 'integer']);?>
   Form->input('no_partners', ['label' => 'Maximum No 
of Partners','type' => 'integer']);?>
   Form->input('no_emails', ['label' => 'Maximum No 
of Emails/Month','type' => 'integer']);?>
   Form->input('storage', ['label' => 'Maximum 
Allowed Storage Space (GB)','type' =>?>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: RESTful (Form) Validation?

2014-03-12 Thread OJ Tibi - @ojtibi
AD,

I would just want to say that your reply was helpful! I'm now reading the 
details of crud/Error/CrudExceptionRenderer.php  and 
crud/Error/Exception/CrudValidationException and I'll be taking cue from 
these. It also looks like the friendsofcake/crud plugin will be very useful 
to me someday when I start on a new project. For now, I'll just be taking 
bits and pieces from that idea since I'm already in the middle of 
prototyping.

Cheers,
OJ

On Wednesday, March 12, 2014 12:06:00 PM UTC+8, OJ Tibi - @ojtibi wrote:
>
> Hi folks,
>
> I was wondering if there was a way to let the client app know which fields 
> it submitted have validation errors. (As you can see, I placed "Form" 
> between parentheses because there isn't really an HTML form in a REST API 
> request.) While the Cookbook recommends to use the built-in Exception 
> classes to respond to errors in REST requests, there is no recommended way 
> to include Model::validationErrors in the response.
>
> Right now, I'm inclined to create my own subclass of HttpException, but 
> after reading the core files, it looks like I might also need to create a 
> custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
> Essentially, I just want to add a 'validation_errors' key in the 
> '_serialize' array exported by ExceptionRenderer.
>
> The question is, will I be overdoing it if I did what I outlined above, 
> *or* should I just pass a implode()'d Model::validationErrors as a $message 
> to BadRequestException/InternalErrorException? Also note that 
> Model::validationErrors is a multi-level array with named keys.
>
> Cheers,
> OJ
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: RESTful (Form) Validation?

2014-03-12 Thread OJ Tibi - @ojtibi
Thanks, AD. I'll be reading the example today.

Cheers,
OJ

On Wednesday, March 12, 2014 12:06:00 PM UTC+8, OJ Tibi - @ojtibi wrote:
>
> Hi folks,
>
> I was wondering if there was a way to let the client app know which fields 
> it submitted have validation errors. (As you can see, I placed "Form" 
> between parentheses because there isn't really an HTML form in a REST API 
> request.) While the Cookbook recommends to use the built-in Exception 
> classes to respond to errors in REST requests, there is no recommended way 
> to include Model::validationErrors in the response.
>
> Right now, I'm inclined to create my own subclass of HttpException, but 
> after reading the core files, it looks like I might also need to create a 
> custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
> Essentially, I just want to add a 'validation_errors' key in the 
> '_serialize' array exported by ExceptionRenderer.
>
> The question is, will I be overdoing it if I did what I outlined above, 
> *or* should I just pass a implode()'d Model::validationErrors as a $message 
> to BadRequestException/InternalErrorException? Also note that 
> Model::validationErrors is a multi-level array with named keys.
>
> Cheers,
> OJ
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: RESTful (Form) Validation?

2014-03-12 Thread AD7six
I recommend taking a look at https://github.com/friendsofcake/crud, if not 
for the code (but why not =) ) for an example of how to do what you ask 
e.g. http://friendsofcake.com/crud/examples/blog.html#validation_errors

curl -I -X POST http://your-site-domain.com/posts/add.json \
>   -d title="My new JSON API blog post"
>
> HTTP/1.1 400 Bad Request
> Server: nginx/1.4.1
> Date: Sun, 16 Jun 2013 12:25:12 GMT
> Content-Type: application/json; charset=UTF-8
> Content-Length: 69
> Connection: keep-alive
> Set-Cookie: CAKEPHP=vevclsl2o6r7h4v7uon9j5tkd1; expires=Sun, 16-Jun-2013 
> 16:25:12 GMT; path=/; HttpOnly
>
> {
>   "success": false,
>   "data": {
> "body": ["This field cannot be left blank"]
>   }
> }
>
>
AD

On Wednesday, 12 March 2014 05:06:00 UTC+1, OJ Tibi - @ojtibi wrote:
>
> Hi folks,
>
> I was wondering if there was a way to let the client app know which fields 
> it submitted have validation errors. (As you can see, I placed "Form" 
> between parentheses because there isn't really an HTML form in a REST API 
> request.) While the Cookbook recommends to use the built-in Exception 
> classes to respond to errors in REST requests, there is no recommended way 
> to include Model::validationErrors in the response.
>
> Right now, I'm inclined to create my own subclass of HttpException, but 
> after reading the core files, it looks like I might also need to create a 
> custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
> Essentially, I just want to add a 'validation_errors' key in the 
> '_serialize' array exported by ExceptionRenderer.
>
> The question is, will I be overdoing it if I did what I outlined above, 
> *or* should I just pass a implode()'d Model::validationErrors as a $message 
> to BadRequestException/InternalErrorException? Also note that 
> Model::validationErrors is a multi-level array with named keys.
>
> Cheers,
> OJ
>

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


RESTful (Form) Validation?

2014-03-11 Thread OJ Tibi - @ojtibi
Hi folks,

I was wondering if there was a way to let the client app know which fields 
it submitted have validation errors. (As you can see, I placed "Form" 
between parentheses because there isn't really an HTML form in a REST API 
request.) While the Cookbook recommends to use the built-in Exception 
classes to respond to errors in REST requests, there is no recommended way 
to include Model::validationErrors in the response.

Right now, I'm inclined to create my own subclass of HttpException, but 
after reading the core files, it looks like I might also need to create a 
custom ErrorHandler and ExceptionRenderer class, if I understand correctly. 
Essentially, I just want to add a 'validation_errors' key in the 
'_serialize' array exported by ExceptionRenderer.

The question is, will I be overdoing it if I did what I outlined above, 
*or* should I just pass a implode()'d Model::validationErrors as a $message 
to BadRequestException/InternalErrorException? Also note that 
Model::validationErrors is a multi-level array with named keys.

Cheers,
OJ

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 1.3: How to display form validation error messages when form is not tied to a model?

2013-11-01 Thread Stephen Tang
I have a view where I used FormHelper methods ($this->Form->input, etc.) to 
create a form (post), but this form is not tied to any model.  It's a dumb 
form.  

For example, some fields are date fields.  My controller will do some 
validation on these fields, but if there is a problem, how would I display 
the error message right below the field that had a validation error?  With 
forms tied to models, CakePHP will automagically add a div to the relevant 
field to display the validation error message.  Is there something similar 
for dumb forms?

Thank you for the assistance.


-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Form validation multiple model errors

2013-05-15 Thread raymond . vanrijs
Hi,

Got a client update form with a lot of client data split over 2 DB tables 
(so 2 CakePHP models). 

My form named 'Client' have fields like:

  
Bedrijfsnaam *

  Form->input('UserData.companyname', array('label' => false, 'error' 
=> array('wrap' => 'div', 'class' => 'error'))); ?>

  
   
  
Straatnaam 
*

  Form->input('UserData.company_street', array('label' => false, 
'error' => array('wrap' => 'div', 'class' => 'error'))); ?>

   

  
Gebruikersnaam

  Form->input('Client.username',  array('label' => false, 'error' => 
array('wrap' => 'div', 'class' => 'error'))); ?>

   

In my Client controller i validate the data this way:
$this->Client->set( $this->data['Client'] );
$this->Clientdata->set( $this->data['UserData'] );

if($this->Clientdata->validates() && $this->Client->validates()) {


The problem: my validation errors don't show up in my update form. My 
validation fails because i get results when i print the errors with: 
print_r($this->Client->invalidFields()); and 
print_r($this->Clientdata->invalidFields());

Anybody know what is wrong here? Has it to do with my input form names?

I'm curious!

Raymond

-- 
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 group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Form validation and business logic

2012-08-27 Thread Dr. Tarique Sani
> Please help me with my doubts of form validation, is form validation a part
> of business logic?
> if yes, then why we put this in Controller?

You are not supposed put form validation logic in Controller - if you
are doing it then it is wrong

Tarique

-- 
=
PHP for E-Biz: http://sanisoft.com
=

-- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Form validation and business logic

2012-08-27 Thread Greg Skerman
Not sure I follow.. "form validation" is data validation - it rightly
belongs in the model.

The concept of "fat models" suggests that business logic should be pushed
back closer to the business objects (i.e. put business logic in the model),
and leave controllers to manage flow.

The authentication component doesn't deal with business logic, it deals
with program flow (whether or not something is accessible, and what happens
if it is or isn't).

On Tue, Aug 28, 2012 at 3:43 AM, sanjay.pal  wrote:

> Hi all,
>
> As per my knowledge, Business Logic is the part of Model in MVC
> architecture.
> Please help me with my doubts of form validation, is form validation a part
> of business logic?
>  if yes, then why we put this in Controller?
> if no, then what is actually a business logic in a authentication module.
>
> Please guys...
>
> Thanks a ton in advance...
>
>
>
> --
> View this message in context:
> http://cakephp.1045679.n5.nabble.com/Form-validation-and-business-logic-tp5710722.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> 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
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Form validation and business logic

2012-08-27 Thread sanjay.pal
Hi all, 

As per my knowledge, Business Logic is the part of Model in MVC
architecture. 
Please help me with my doubts of form validation, is form validation a part
of business logic?
 if yes, then why we put this in Controller? 
if no, then what is actually a business logic in a authentication module. 

Please guys... 

Thanks a ton in advance... 



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Form-validation-and-business-logic-tp5710722.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Form validation and business logic

2012-08-27 Thread Sanjay
Hi all,

As per my knowledge, Business Logic is the part of Model in MVC 
architecture.
Please help me with my doubts of form validation, is form validation a part 
of business logic?
if yes, then why we put this in Controller?
if no, then what is actually a business logic in a authentication module.

Please guys...

Thanks a ton in advance...

-- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Form validation always fails - but there is no validation in the model.

2012-05-25 Thread Papa Gateau
Hi,

I'm at my wits end on this one, so I'm hoping some of the great and
good here can help me out.

The client site is on cakePHP1.1 (and an upgrade is not on the cards
for quite sometime).

I have a very simple form which was always returning validation
message (from the setFlash - see code snippet below) but not any
validation errors (the validationErrors is returning Null when I
var_dump it) - so I removed the validation rules from the model and
still get the same behaviour.

I just don't understand what is going on here, so any help or pointers
gratefully received.

Thanks
PG

All relevant code posted below:

Model:

class SeoDefault extends AppModel {

var $name = 'SeoDefault';
/*var $validate = array(
'region_code' => VALID_NUMBER,
'section_id' => VALID_NUMBER,
'title' => VALID_NOT_EMPTY,
'blurb' => VALID_NOT_EMPTY
);*/

}

Controller:

class SeoDefaultsController extends AppController {

var $name = 'SeoDefaults';
var $helpers = array('Html', 'Form', 'Javascript','Pagination');
var $uses = array('SeoDefault','Section');

function admin_edit($id = null) {

$this->set('sections', $this->Section-
>generateList(null,null,null,'{n}.Section.id', '{n}.Section.name'));

if (empty($this->data)) {
if ($id) {
$this->data = $this->SeoDefault->read(null, 
$id);
}
} else {
$this->cleanUpFields();

if ($this->SeoDefault->save($this->data)) {
$this->Session->setFlash('The SEO Default has 
been saved');
$this->redirect('/admin/seo_defaults/index');
} else {
$this->Session->setFlash('Please correct errors 
below.');
}
}

}
}

Admin_Edit view:

SEO Default

link('List SEO Defaults', '/admin/seo_defaults/
index'); ?>
link('New SEO Default', '/admin/seo_defaults/
edit'); ?>



Edit SEO Default Details


labelTag('SeoDefault/region_code', 'International
or UK');?>
selectTag('SeoDefault/
region_code',array("1"=>"UK","2"=>"International"),$html-
>tagValue('SeoDefault/region_code'), array(), array(), true, true);?
>Which website does this apply to UK or
International
tagErrorMsg('SeoDefault/region_code', 'Please
select the website that these defaults apply to.');?>



labelTag('SeoDefault/section_id', 'Section');?>
selectTag('SeoDefault/section_id',$sections,$html-
>tagValue('SeoDefault/section_id'), array(), array(), true, true);?
>The section of the website that these defaults
apply to. e.g. news
tagErrorMsg('SeoDefault/section_id', 'Please select
the section that these defaults apply to.');?>


labelTag('SeoDefault/title', 'Title');?>
input('SeoDefault/title');?>The
Default Meta title. max. 65 chars.
tagErrorMsg('SeoDefault/title', 'Please enter the
Meta Title');?>


labelTag('SeoDefault/blurb', 'Desc.');?>
textarea('SeoDefault/blurb', array('cols' => '60',
'rows' => '12', 'class' => 'mceNoEditor'));?>Please
provide the Meta description for this section. Max. 250 chars
tagErrorMsg('SeoDefault/blurb', 'Please enter the
Meta Description.');?>




hidden('SeoDefault/id')?>

submit('Save');?>



And in case it's useful the Model for the Section (again with
validation commented out):

class Section extends AppModel {

var $name = 'Section';

/*var $validate = array(
'name' => VALID_NOT_EMPTY,
);*/

}

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


CakePHP. Few form validation on same page

2012-04-14 Thread Scofield
Hello.
My problem is that I can understand how can I validate few or more forms 
placed on the same page.

What I have on the page:


Code (controller):

function signup() {
>   $this->User->set($this->data);
>   $this->User->validates($this->data);
> }
> function signin() { 
>  $this->User->set($this->data);
>  $this->User->validates($this->data);
> }

Code (validation) :

var $validate = array(
>   'username_up' => array(
>  'rule' => 'alphaNumeric',
>  'required' => true,
>  'allowEmpty' => false,
>  'message' => 'Имя пользователя некорректное'
>   ),
>   'password1' => array(
>  'rule' => 'alphaNumeric',
>  'required' => true,
>  'allowEmpty' => false,
>  'message' => 'Введенный пароль некорректный'
>   ),
>   'username_in' => array(
>  'rule' => 'alphaNumeric',
>  'required' => true,
>  'allowEmpty' => false,
>  'message' => 'Имя пользователя некорректное'
>   ),
>   'password2' => array(
>  'rule' => 'alphaNumeric',
>  'required' => true,
>  'allowEmpty' => false,
>  'message' => 'Введенный пароль некорректный'
>   )
>);

What I get when click on blue button:


 How I created forms:


>Регистрация
>   echo $form->create('User',array('action'=>'signup'));
>   echo 
> $form->input('username_up',array('label'=>false,'value'=>'Имя 
> пользователя','div'=>false));  
>   echo 
> $form->input('password1',array('label'=>false,'value'=>'Пароль','title'=>'Пароль','div'=>false,'type'=>'password'));
>   echo 
> $form->submit('Зарегистрироваться',array('class'=>'submit','div'=>false));
>   echo $form->end();
>?>
> 
> 
>Вход
>   echo $form->create('User',array('action'=>'signin'));
>   echo 
> $form->input('username_in',array('label'=>false,'value'=>'Имя 
> пользователя','div'=>false));
>   echo 
> $form->input('password2',array('label'=>false,'value'=>'Пароль','title'=>'Пароль','div'=>false,'type'=>'password'));
>   echo 
> $form->submit('Вход',array('class'=>'submit','div'=>false));
>   echo $form->end();
>?>
> 

-- 
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: Form validation error doesn't show! CPHP 1.3

2011-12-28 Thread Ersin Demirtas
I found the solution :D,

just update the required fields.

$this->_refreshAuth('username',$this->data['User']['username']);

-- 
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: Form validation error doesn't show! CPHP 1.3

2011-12-28 Thread Ersin Demirtas
OK, I found the problem I was using this function some how this
function disables errors. please help..


  function _refreshAuth($field = '', $value = '') {
if (!empty($field) && !empty($value)) {
$this->Session->write($this->Auth->sessionKey .'.'. 
$field,
$value);
} else {
if (isset($this->User)) {
$this->Auth->login($this->User->read(false, 
$this->Auth-
>user('id')));
} else {

$this->Auth->login(ClassRegistry::init('User')->findById($this-
>Auth->user('id')));
}
}
}

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


Form validation error doesn't show! CPHP 1.3

2011-12-28 Thread Ersin Demirtas
Form validation error doesn't show! CPHP 1.3

I have a user model and in my user model i have

User Model

 array(
'usernameRule' => array(
'rule' => 'alphaNumeric',
'message' => 'Alphabetic and Number characters 
only'

),
'usernameRule2' => array(
'rule' => array('minLength', 6),
'message' => 'Minimum length of 6 characters'
),
),
'password' => array(
'passwordRule' => array(
'rule' => 'alphaNumeric',
'message' => 'Alphabetic and Number characters 
only'

),
'passwordRule2' => array(
'rule' => array('minLength', 6),
'message' => 'Minimum length of 6 characters'
),
)
);
}
?>
in my user controller i have included from helper but doesn't show
error for username field or password field when I enter less then 6
chars..

thanks. by the way I am not getting error when I am updating a user
data but when i user user add form it works.

User Controller
---

Session->destroy();
$this->redirect($this->Auth->logout());
}

   function _refreshAuth($field = '', $value = '') {
if (!empty($field) && !empty($value)) {
$this->Session->write($this->Auth->sessionKey .'.'. 
$field,
$value);
} else {
if (isset($this->User)) {
$this->Auth->login($this->User->read(false, 
$this->Auth-
>user('id')));
} else {

$this->Auth->login(ClassRegistry::init('User')->findById($this-
>Auth->user('id')));
}
}
}

   function forgot(){
 if (!empty($this->data)){
$user = $this->User->find('first',array('conditions' =>
array('email' =>$this->data['User']['email'])));
if(!empty($user)){
$newPassword = $this->_createRandomPassword(8);
$this->Email->from= 'Example ';
$this->Email->to  = $this->data['User']['email'];
$this->Email->subject = 'Example Password!';
$this->Email->send('Dear '.$user['User']['username'].', 
your new
password is '.$newPassword.'. Please login and update your
password.');

$this->data['User']['password'] = $this->Auth-
>password($newPassword);
$this->User->id = $user['User']['id'];

$data = array(
   'User' => array(
'id'  =>
$user['User']['id'],
'password'   =>$this->Auth-
>password($newPassword)
   )
);
$this->User->save( $data, true, array('password') );

$this->Session->setFlash('Thanks, your new password is 
been sent to
your email!');
} else {
$this->Session->setFlash("Sorry, this email doesn't 
exsits!");
}
}
}

function profile(){
$this->set('user',$this->Auth->user());

if (!empty($this->data)) {
$this->User->id = $this->Auth->user('id');


if(empty($this->data['User']['password'])){

$this->data['User']['password'] = $this->Auth-
>user('password');
}
$this->User->

Re: RE: CakePHP Form Validation Errors -- no luck???

2011-07-23 Thread KingInky
Hey, thank you! You were completely right. I'm feeling a little dumb right 
now :]

-- 
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: RE: CakePHP Form Validation Errors -- no luck???

2011-07-23 Thread Tilen Majerle
i think, filename should be user.php not user_model.php :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/7/23 KingInky 

> I have had no luck figuring this out. Still seeking answers. Thank you all.
>
>
> --
> 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: RE: CakePHP Form Validation Errors -- no luck???

2011-07-23 Thread KingInky
I have had no luck figuring this out. Still seeking answers. Thank you all.

-- 
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: RE: CakePHP Form Validation Errors -- no luck???

2011-07-22 Thread KingInky
Sure.

The model (user_model.php): http://pastebin.com/RdaEfnCn
The controller (users_controller.php): http://pastebin.com/4pfbWZKE
The view (register.ctp): http://pastebin.com/aTjTya6z

Thanks again for your help.

-- 
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: CakePHP Form Validation Errors -- no luck???

2011-07-22 Thread Meroe Kush
Please pastebin your model, view, and controller.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of KingInky
Sent: Friday, July 22, 2011 6:42 PM
To: CakePHP
Subject: CakePHP Form Validation Errors -- no luck???

Hello,

I'm a CakePHP amateur. I've converted a clients Wordpress into a
CakePHP website (or have been trying to, at least). I just started
doing his registration form. For whatever reason, it is NOT validating
any of the rules I've setup in my model. I've had people in the
CakePHP IRC look at and comment on my code, but no one sees anything
wrong. I don't know what's going on, because I've done simple
registration/login systems in CakePHP before with no problem
(normally, the errors display).

My latest theory is that possibly the errors are being passed (though
I honestly don't think they are), but not being displayed. I'd like to
try and print out (using pre()) the array that holds the validation
errors, but I have no idea where that is located.

Other than that, I'm open to further suggestions. Please help me,
because this is VERY time-sensitive.

Thank you all very much.
I will be checking regularly,
Ethan

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


CakePHP Form Validation Errors -- no luck???

2011-07-22 Thread KingInky
Hello,

I'm a CakePHP amateur. I've converted a clients Wordpress into a
CakePHP website (or have been trying to, at least). I just started
doing his registration form. For whatever reason, it is NOT validating
any of the rules I've setup in my model. I've had people in the
CakePHP IRC look at and comment on my code, but no one sees anything
wrong. I don't know what's going on, because I've done simple
registration/login systems in CakePHP before with no problem
(normally, the errors display).

My latest theory is that possibly the errors are being passed (though
I honestly don't think they are), but not being displayed. I'd like to
try and print out (using pre()) the array that holds the validation
errors, but I have no idea where that is located.

Other than that, I'm open to further suggestions. Please help me,
because this is VERY time-sensitive.

Thank you all very much.
I will be checking regularly,
Ethan

-- 
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: Security form validation: is there a log somewhere?

2011-07-13 Thread DragonFlyEye
Thank you for this information. Basically, I should just not count on CSRF 
protection in AJAX, which I get. I'm assuming I must be making some change 
to the form in question via AJAX, I guess I'll have to turn off the 
validation.

-- 
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: Security form validation: is there a log somewhere?

2011-07-12 Thread Jens Dittrich
As long as you are overriding the naming with the help of the form helper 
you should not encouter problems.
If you make changes with JavaScript on the clientside or load option lists 
(for example) via AJAX then the security component will stop you. That is 
mostly because of its CSRF protection that is part of security helper.
Basically the security component uses the form helper to get information 
about the fields and then creates a key that identifies exactly this form 
and it will only accept this form.

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


Security form validation: is there a log somewhere?

2011-07-12 Thread DragonFlyEye
I've finally figure out that CakePHP's Security Component will validate form 
fields, dumping the user out on a 404 if anything is wrong. Great, but now 
the question is: what is wrong?

According to the documentation, the form should be setup via the Form 
Helper. It is. But other than that, no guidance is given as to what might 
poison the well? It only mentions "certain conditions" without any 
specifics.

The form is opened and closed using the Form Helper. The fields are all 
created using Form Helper methods. The only other thing I can think of is 
that I'm overriding the default naming of fields for my own purposes. 
Switching back to CakePHP's defaults would be hard to test.

-- 
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: Form Validation

2011-04-28 Thread Walther
Before accusing the manual of being crap, perhaps you should take some
time to actually read it?

How to implement validation in the model: 
http://book.cakephp.org/view/1143/Data-Validation
How to do validation from your controller:
http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
How to show validation message: On 
http://book.cakephp.org/view/1143/Data-Validation
it says "For more information about how to handle the displaying of
validation errors, check out the section covering FormHelper." in the
second paragraph. Reading through the section on the FormHelper,
you'll quickly discover how it works.

All this stuff in one place: http://book.cakephp.org/view/1538/Data-Validation

As for your immediate issue, if you had actually read the section in
the book about validation data from the controller, you'd know exactly
what to do. 
http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller

I quote:
First, set the data to the model:
$this->ModelName->set( $this->data );
Then, to check if the data validates, use the validates method of the
model, which will return true if it validates and false if it doesn't:
if ($this->ModelName->validates()) {// it validated logic} else
{// didn't validate logic}

On Apr 29, 4:31 am, Sanfly  wrote:
> Hi
>
> My cake version is 1.3.7
>
> I'm just learning form validation and am having a few issues.
>
> Firstly, the manual is crap in that it doesn't tell you how to
> implement the validation in your model, and it doesn't tell you how to
> show the validation error messages in your view.  Took a lot of
> digging to find all that!
>
> Anyway, on the the problem at hand.  I thought I had this working on
> one field, went to implement for the rest of my fields and now it is
> always validating the form even when I have deliberately used inputs
> that should fail validation.  I have stripped it back down to one
> field to try and get it working again
>
> In my model: user.php
>
> // VALIDATION
>         var $validate = array(
>                         'first_name' => 'notEmpty'
>
>                 );
>
> In my controller:
>
> function add(){
>
>                 if($this->data){
>                         if ($this->User->validates($this->data)) {
>                                 echo "does validate";
>
>                         }
>                         else { //data doesn't validate
>                                 echo "doesnt validate";
>                                 $this->Session->setFlash('Please correct 
> errors below.');
>                         }
>
>                 }
>         }
>
> Can anyone see an obvious error that I have overlooked?
>
> BTW, the 'does validate' and 'doesn't validate' are just in there for
> me to see easily where my problems are occuring.  Obviously wouldnt be
> there for production

-- 
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: Form Validation

2011-04-28 Thread Tilen Majerle
Before you call $this->User->validates() you must the data to model...do
this
$this->User->set($this->data)

On Apr 29, 2011 4:31 AM, "Sanfly"  wrote:

Hi

My cake version is 1.3.7

I'm just learning form validation and am having a few issues.

Firstly, the manual is crap in that it doesn't tell you how to
implement the validation in your model, and it doesn't tell you how to
show the validation error messages in your view.  Took a lot of
digging to find all that!

Anyway, on the the problem at hand.  I thought I had this working on
one field, went to implement for the rest of my fields and now it is
always validating the form even when I have deliberately used inputs
that should fail validation.  I have stripped it back down to one
field to try and get it working again

In my model: user.php

// VALIDATION
   var $validate = array(
   'first_name' => 'notEmpty'

   );

In my controller:

function add(){

   if($this->data){
   if ($this->User->validates($this->data)) {
   echo "does validate";

   }
   else { //data doesn't validate
   echo "doesnt validate";
   $this->Session->setFlash('Please correct
errors below.');
   }

   }
   }

Can anyone see an obvious error that I have overlooked?

BTW, the 'does validate' and 'doesn't validate' are just in there for
me to see easily where my problems are occuring.  Obviously wouldnt be
there for production

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


Form Validation

2011-04-28 Thread Sanfly
Hi

My cake version is 1.3.7

I'm just learning form validation and am having a few issues.

Firstly, the manual is crap in that it doesn't tell you how to
implement the validation in your model, and it doesn't tell you how to
show the validation error messages in your view.  Took a lot of
digging to find all that!

Anyway, on the the problem at hand.  I thought I had this working on
one field, went to implement for the rest of my fields and now it is
always validating the form even when I have deliberately used inputs
that should fail validation.  I have stripped it back down to one
field to try and get it working again

In my model: user.php

// VALIDATION
var $validate = array(
'first_name' => 'notEmpty'

);

In my controller:

function add(){

if($this->data){
if ($this->User->validates($this->data)) {
echo "does validate";

}
else { //data doesn't validate
echo "doesnt validate";
$this->Session->setFlash('Please correct errors 
below.');
}

}
}

Can anyone see an obvious error that I have overlooked?

BTW, the 'does validate' and 'doesn't validate' are just in there for
me to see easily where my problems are occuring.  Obviously wouldnt be
there for production

-- 
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: Form Validation with more than one model

2011-03-21 Thread Jeremy Burns | Class Outfit
What I understood from your original post was that you wanted to store the 
users address in more than one model, i.e. the same data in multiple places, as 
opposed to storing the data once in one place and creating references to it 
from other places. Forgive me if I misunderstood.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Mar 2011, at 10:35, duderion wrote:

> what do you mean with 'but it isn't storing the same data multiple
> times' ?
> 
> On 15 Mrz., 05:49, Jeremy Burns | Class Outfit
>  wrote:
>> Yes, this takes your data array and stores parts of it in different models, 
>> but it isn't storing the same data multiple times. That's an admin 
>> nightmare, so as I mentioned before, the best solution is to examine your 
>> database design.
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> 
>> On 14 Mar 2011, at 23:46, duderion wrote:
>> 
>>> i found a cool solution :D
>> 
>>> http://nuts-and-bolts-of-cakephp.com/2008/08/01/practical-use-of-save...
>> 
>>> greets
>>> duderion
>> 
>>> On Mar 15, 12:36 am, duderion  wrote:
 hi guys,
>> 
 i have a users/add form, and i want to store the users address data to
 several models (adresses,accounts, etc)
>> 
 so i have more than one model to validate.
>> 
 whats the best practice ?
>> 
 duderion
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 
>>> athttp://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

-- 
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: Form Validation with more than one model

2011-03-21 Thread duderion
what do you mean with 'but it isn't storing the same data multiple
times' ?

On 15 Mrz., 05:49, Jeremy Burns | Class Outfit
 wrote:
> Yes, this takes your data array and stores parts of it in different models, 
> but it isn't storing the same data multiple times. That's an admin nightmare, 
> so as I mentioned before, the best solution is to examine your database 
> design.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 14 Mar 2011, at 23:46, duderion wrote:
>
> > i found a cool solution :D
>
> >http://nuts-and-bolts-of-cakephp.com/2008/08/01/practical-use-of-save...
>
> > greets
> > duderion
>
> > On Mar 15, 12:36 am, duderion  wrote:
> >> hi guys,
>
> >> i have a users/add form, and i want to store the users address data to
> >> several models (adresses,accounts, etc)
>
> >> so i have more than one model to validate.
>
> >> whats the best practice ?
>
> >> duderion
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 
> > athttp://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: Form Validation with more than one model

2011-03-14 Thread Jeremy Burns | Class Outfit
Yes, this takes your data array and stores parts of it in different models, but 
it isn't storing the same data multiple times. That's an admin nightmare, so as 
I mentioned before, the best solution is to examine your database design.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Mar 2011, at 23:46, duderion wrote:

> i found a cool solution :D
> 
> http://nuts-and-bolts-of-cakephp.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/
> 
> greets
> duderion
> 
> On Mar 15, 12:36 am, duderion  wrote:
>> hi guys,
>> 
>> i have a users/add form, and i want to store the users address data to
>> several models (adresses,accounts, etc)
>> 
>> so i have more than one model to validate.
>> 
>> whats the best practice ?
>> 
>> duderion
> 
> -- 
> 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: Form Validation with more than one model

2011-03-14 Thread Jeremy Burns | Class Outfit
Design your database better so it's only stored once.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Mar 2011, at 23:36, duderion wrote:

> hi guys,
> 
> i have a users/add form, and i want to store the users address data to
> several models (adresses,accounts, etc)
> 
> so i have more than one model to validate.
> 
> whats the best practice ?
> 
> duderion
> 
> -- 
> 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: Form Validation with more than one model

2011-03-14 Thread duderion
i found a cool solution :D

http://nuts-and-bolts-of-cakephp.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/

greets
duderion

On Mar 15, 12:36 am, duderion  wrote:
> hi guys,
>
> i have a users/add form, and i want to store the users address data to
> several models (adresses,accounts, etc)
>
> so i have more than one model to validate.
>
> whats the best practice ?
>
> duderion

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


Form Validation with more than one model

2011-03-14 Thread duderion
hi guys,

i have a users/add form, and i want to store the users address data to
several models (adresses,accounts, etc)

so i have more than one model to validate.

whats the best practice ?

duderion

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-27 Thread kdubya
Oops, I neglected to say the your create() needs to change:

echo $this->Form->create('Plan', array('action' => 'search_form'));

instead of:
echo $this->Form->create('Plan', array('action' => 'search'));

On Feb 26, 2:01 pm, kdubya  wrote:
> So, in your search() action, call the validates() method as show in
> the book 
> here:http://book.cakephp.org/view/3/The-Manual#!/view/410/Validating-Data-...
>
> Something like:
> if ($this->Plan->validates()) {
>         // continue to show your search results view} else {
>
>         // didn't validate logic
>        $this->redirect(SearchFormView); // Send them back to the
> search form
>
> }
>
> HTH,
> Ken

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-27 Thread kdubya
Sorry, you are absolutely right, redirecting causes the validation
error messages to be lost. So, reverse the logic.

You currently have a view that renders the form that collects the
search criteria (you don't say what this is but I'll call it
search_form as I did above). So there is an action and a view called
search_form. The action search_form() will do the call to validates()
and if the result is false, re-renders the search form with the
errors. If the validation is successful, THEN you redirect to the
action/view that renders the search results.

function search_form() {
  if ($this->Plan->validates()) {
 $this->redirect('search'); // Renders the search results
  }
  // Drops through to re-render search form
}

Ken

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread OldWest
I solved the issue by using implode(), but my errors are no longer 
displaying below my form fields. Errors are displaying in the default 
layout... Hmmm.. Anyhow here is my working code:

...else {
  $errors = $this->Plan->invalidFields();
  $error_messages = implode(' ',$errors);
  $this->Session->setFlash($error_messages);
  $this->redirect('/'); ...

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread OldWest
kdubya,

I've already tried that several times. The error *never* displays *because *of 
the redirect.

I am trying to work it into a session, but no luck yet : (

else {
  //$errors = $this->Plan->invalidFields();
  //$this->Plan->validates();
  $errors = $this->Plan->invalidFields();
  debug($errors);
  //$this->Session->setFlash() = $this->Plan->invalidFields();
  $this->Session->setFlash("this works, but how do I get the errors array 
from my model and \$this->Plan->validates() in here???");
  $this->redirect('/');
} 
}


-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread kdubya
So, in your search() action, call the validates() method as show in
the book here:
http://book.cakephp.org/view/3/The-Manual#!/view/410/Validating-Data-from-the-Controller

Something like:
if ($this->Plan->validates()) {
// continue to show your search results view
} else {
// didn't validate logic
   $this->redirect(SearchFormView); // Send them back to the
search form
}

HTH,
Ken

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread OldWest
Hi Stephen,

I don't have a *search *controller. My *search()* action is in my *Plan *
controller.

The validation works, but naturally directs to the* plan/search(.ctp)* view 
file which of course displays 0 results, but the validation message appears 
just fine. I just don't want the *search.ctp* file to display prior to the 
form validating - the element (that contains the form) should "stand alone" 
or appear that way until validation happens - then the search page can be 
displayed. This way no matter where I put the form it can validate 
stand-alone and only search when in fact validated.




-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread Stephen
Use custom routing to change /plans/search to /search

If that is the reason?

On 26 February 2011 11:15, Stephen  wrote:

> Why do you have a search controller?
>
> Have a search action in the PlansController, as I assume you are searching
> for plans.
>
> You don't need to call the form from the search action, you can call it
> from anywhere and it will validate - if it doesn't validate, redirect to the
> referer?
>
> a Plan is an Object, a Model. A Search isn't an object so it shouldn't have
> its own controller, that's my opinion.
>
> --
> Kind Regards
>  Stephen
>
>  http://www.ninjacodermonkey.co.uk
>
>
>


-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

-- 
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: CakePHP form validation before sending post to the requested controller function

2011-02-26 Thread Stephen
Why do you have a search controller?

Have a search action in the PlansController, as I assume you are searching
for plans.

You don't need to call the form from the search action, you can call it from
anywhere and it will validate - if it doesn't validate, redirect to the
referer?

a Plan is an Object, a Model. A Search isn't an object so it shouldn't have
its own controller, that's my opinion.

-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

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


CakePHP form validation before sending post to the requested controller function

2011-02-25 Thread OldWest


My validation is working as it stands, but I want to display the validation 
error prior to the search controller. I understand this might not be 
possible within the CakePHP framework.

I have a model *plan.php*. And in the *plans_controller.php*, I have a 
function called *search()*.

My form calls *search()* as expected (because there is no search model):

echo $this->Form->create('Plan', array('action' => 'search'));

As it stands, when I submit my search, the errors are displayed and the url 
changes to .../search, so no results are displayed ("There are 0 results for 
that search criteria", but the correct validation errors are displayed below 
required form fields.

I do not want the .../search url to be displayed. I want the form to "halt" 
and just display the validation errors w/out changing the url to the search 
function.

I am calling the search form within an element because the search form 
displays on several different pages.

To sum this up: The search form should validate w/out changing the url path 
to the controller action name of the search. Of course, the validation is 
done IN the search() and plan.php model, so I just don't know how to work 
around this and wondering if its even possible.

-- 
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: Universal search form validation using a fake model

2011-01-29 Thread cricket
On Sat, Jan 29, 2011 at 3:50 AM, digitalw00t  wrote:
> Models:
> Vehicles hasMany Doors, Wheels
>        Actions:  index, search, view, add, edit, delete
> Doors           belongsTo Vehicles
> Wheels          belongsTo Vehicles
> Customers       hasMany Vehicles
>
> urls:
> vehicles/index - list all vehicles for the past 2 weeks
> vehicles/search - list only the vehicles based off the form in the
> search view, but should display the records in the vehicle.index view
>
> Search form Validation:
> Doors can be no more than 4 and must be a positive number
> Wheels cannot be greater than 16 but must be a positive number
> Customer must have at least 4 characters
>
> My initial thoughts are to create a fake search model to do the search
> view's form validation.  This would insure that the form data was of a
> nature that wouldn't cause undue stress on the database.  Any ideas?

Not sure what your question is. In any case, wouldn't it be better to
have doors & wheels to be columns in the vehicles table, rather than
associated models?

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


Universal search form validation using a fake model

2011-01-29 Thread digitalw00t
Models:
Vehicles hasMany Doors, Wheels
Actions:  index, search, view, add, edit, delete
Doors   belongsTo Vehicles
Wheels  belongsTo Vehicles
Customers   hasMany Vehicles

urls:
vehicles/index - list all vehicles for the past 2 weeks
vehicles/search - list only the vehicles based off the form in the
search view, but should display the records in the vehicle.index view

Search form Validation:
Doors can be no more than 4 and must be a positive number
Wheels cannot be greater than 16 but must be a positive number
Customer must have at least 4 characters

My initial thoughts are to create a fake search model to do the search
view's form validation.  This would insure that the form data was of a
nature that wouldn't cause undue stress on the database.  Any ideas?

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


Video : Ajax Form Validation in CakePHP 1.3 using Jquery

2011-01-21 Thread Azril Nazli
Ever try to simulate $ajax->observeField() in Cake using Jquery, the
following video shows you how

URL : http://www.php.net.my/forum/video-cakephp-validation-jquery

- the video has no audio so you need to pay attention to whatever I
typed
- recorded using CamStudio in AVI and later converted to FLV, you will
need FLV player

-- 
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: Form Validation does not work on Cake 1.3.6

2011-01-20 Thread Gaetan Allart
I'm using 1.3.6.

Gaëtan

2011/1/19 Amit Badkas 

> Hi,
>
> If you are having 'call to a member of a non-object' error for $this->Form
> then I doubt you are using CakePHP 1.2.x and not 1.3.x
>
> Amit Badkas
>
> PHP Applications for E-Biz: http://www.sanisoft.com
>
>
>
> On Wed, Jan 19, 2011 at 5:38 AM, Kh3ops  wrote:
>
>> Actually, I baked my application and form validation is working fine
>> now.
>>
>> As far as $this is concerned. I would love to use it but it doesn't
>> work : "call to a member of a non-object"...
>>
>> Gaëtan
>>
>> On 11 jan, 05:03, Amit Badkas  wrote:
>> > Hi,
>> >
>> > Your description of the validation problem is too less to give any
>> > suggestion. Also about the usage of $form instead of $this->Form, you
>> can
>> > use $form in CakePHP-1.3.x but it will be removed in future versions and
>> > that's why you have to use $this->Form.
>> >
>> > Amit Badkas
>> >
>> > PHP Applications for E-Biz:http://www.sanisoft.com
>> >
>> > On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops 
>> wrote:
>> > > Hi,
>> >
>> > > I installed cake 1.3.6 on PHP 5.3.3.
>> >
>> > > I've just run through the "blog tutorial" and everything's working
>> > > fine except "form validation".
>> > > For an unknown reason, validating an empty form works and databases is
>> > > filled with empty records.
>> >
>> > > Here is what I used in my model code :
>> >
>> > >  var $validate = array(
>> > >'title' => 'notEmpty'
>> > >);
>> >
>> > > Any idea?
>> >
>> > > Compared to the tutorial, I also had to use $form() instead of $this-
>> > > >Form() functions in templates files. Do you know why?
>> >
>> > > Thanks for your help,
>> >
>> > > Gaëtan
>> >
>> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 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?hl=en
>>
>> 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 from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  --
> 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.comFor
>  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: Form Validation does not work on Cake 1.3.6

2011-01-19 Thread Amit Badkas
Hi,

If you are having 'call to a member of a non-object' error for $this->Form
then I doubt you are using CakePHP 1.2.x and not 1.3.x

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 5:38 AM, Kh3ops  wrote:

> Actually, I baked my application and form validation is working fine
> now.
>
> As far as $this is concerned. I would love to use it but it doesn't
> work : "call to a member of a non-object"...
>
> Gaëtan
>
> On 11 jan, 05:03, Amit Badkas  wrote:
> > Hi,
> >
> > Your description of the validation problem is too less to give any
> > suggestion. Also about the usage of $form instead of $this->Form, you can
> > use $form in CakePHP-1.3.x but it will be removed in future versions and
> > that's why you have to use $this->Form.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops  wrote:
> > > Hi,
> >
> > > I installed cake 1.3.6 on PHP 5.3.3.
> >
> > > I've just run through the "blog tutorial" and everything's working
> > > fine except "form validation".
> > > For an unknown reason, validating an empty form works and databases is
> > > filled with empty records.
> >
> > > Here is what I used in my model code :
> >
> > >  var $validate = array(
> > >'title' => 'notEmpty'
> > >);
> >
> > > Any idea?
> >
> > > Compared to the tutorial, I also had to use $form() instead of $this-
> > > >Form() functions in templates files. Do you know why?
> >
> > > Thanks for your help,
> >
> > > Gaëtan
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 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?hl=en
>
> 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

-- 
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: Form Validation does not work on Cake 1.3.6

2011-01-18 Thread Kh3ops
Actually, I baked my application and form validation is working fine
now.

As far as $this is concerned. I would love to use it but it doesn't
work : "call to a member of a non-object"...

Gaëtan

On 11 jan, 05:03, Amit Badkas  wrote:
> Hi,
>
> Your description of the validation problem is too less to give any
> suggestion. Also about the usage of $form instead of $this->Form, you can
> use $form in CakePHP-1.3.x but it will be removed in future versions and
> that's why you have to use $this->Form.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops  wrote:
> > Hi,
>
> > I installed cake 1.3.6 on PHP 5.3.3.
>
> > I've just run through the "blog tutorial" and everything's working
> > fine except "form validation".
> > For an unknown reason, validating an empty form works and databases is
> > filled with empty records.
>
> > Here is what I used in my model code :
>
> >  var $validate = array(
> >        'title' => 'notEmpty'
> >        );
>
> > Any idea?
>
> > Compared to the tutorial, I also had to use $form() instead of $this-
> > >Form() functions in templates files. Do you know why?
>
> > Thanks for your help,
>
> > Gaëtan
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Form Validation does not work on Cake 1.3.6

2011-01-10 Thread Amit Badkas
Hi,

Your description of the validation problem is too less to give any
suggestion. Also about the usage of $form instead of $this->Form, you can
use $form in CakePHP-1.3.x but it will be removed in future versions and
that's why you have to use $this->Form.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops  wrote:

> Hi,
>
> I installed cake 1.3.6 on PHP 5.3.3.
>
> I've just run through the "blog tutorial" and everything's working
> fine except "form validation".
> For an unknown reason, validating an empty form works and databases is
> filled with empty records.
>
> Here is what I used in my model code :
>
>  var $validate = array(
>'title' => 'notEmpty'
>);
>
> Any idea?
>
> Compared to the tutorial, I also had to use $form() instead of $this-
> >Form() functions in templates files. Do you know why?
>
> Thanks for your help,
>
> Gaëtan
>
> 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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?hl=en


Form Validation does not work on Cake 1.3.6

2011-01-10 Thread Kh3ops
Hi,

I installed cake 1.3.6 on PHP 5.3.3.

I've just run through the "blog tutorial" and everything's working
fine except "form validation".
For an unknown reason, validating an empty form works and databases is
filled with empty records.

Here is what I used in my model code :

 var $validate = array(
'title' => 'notEmpty'
);

Any idea?

Compared to the tutorial, I also had to use $form() instead of $this-
>Form() functions in templates files. Do you know why?

Thanks for your help,

Gaëtan

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 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?hl=en


Re: Form validation and routes - errors lead to controller/action instead of route!

2010-11-30 Thread DigitalDude
Hey,


ok I found the solution, and it's really simple. Just use the 'url'
option for the form, and the routes will be no problem anymore.

Here is a brief example how to do it:

In Routes-PHP, there is an entry:
Router::connect('/register', array('controller' => 'users', 'action'
=> 'register'));

And the form in the view of the register action (views/users/
register.ctp) create the form like this:

create('User', array('url' => '/register')); ?>

That points the form to the correct route, which will lead to the
correct action. On errors like empty input fields the route will be
the same again and everthing works fine.

Regards,

DD

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 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?hl=en


Form validation and routes - errors lead to controller/action instead of route!

2010-11-30 Thread DigitalDude
Hey,


the problem I have came up very often the last weeks but I couldn't
find a solution yet. Maybe one of you has a clue how to do this.

The facts:

in my users_controller i have an action called "register", which is
mapped to the route http:://www.domain.com/register

This is working, and very easy to set up. But when I now make any
mistake in the form given in the register action, the url in the
browser switches back to users/register, which is the correct action,
but not the correct route!

I could do a redirect when an error occurs, but the form validation
errors (by model validation OR invalidate()) are gone when a redirect
is done.

There has to be a solution for this, I just do not want to store all
errors in the Session and add the errors manually into the form and
delete them afterwards from the Session.

Does anyone have any idea how to solve this little problem?

Regards,

DD

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 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?hl=en


Re: Form validation errors

2010-09-18 Thread Dr. Loboto
In this case better turn off persistentModel as you did and reopen
ticket. Looks like it is definitely CakePHP bug.

On Sep 17, 6:09 pm, Jeremy Burns | Class Outfit
 wrote:
> Thanks Dr Loboto. Unfortunately that has no effect.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 17 Sep 2010, at 11:56, Dr. Loboto wrote:
>
>
>
> > What if you call create() on this model before save()? Checked code
> > related to $persistModel and get lost there.
>
> > On Sep 17, 1:21 pm, Jeremy Burns | Class Outfit
> >  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 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 Outfit
>
> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> On 17 Sep 2010, at 07:09, Jeremy Burns | Class Outfit wrote:
>
> >>> 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, see the validation 
> >>> messages. Resubmit the form - no validation messages. Clear the cache and 
> >>> start again.
>
> >>> Any clues?
>
> >>> Jeremy Burns
> >>> Class Outfit
>
> >>> jeremybu...@classoutfit.com
> >>> (t) +44 (0) 208 123 3822
> >>> (m) +44 (0) 7973 481949
> >>> Skype: jeremy_burns
> >>>http://www.classoutfit.com
>
> >>> On 17 Sep 2010, at 06:59, Jeremy Burns | Class Outfit wrote:
>
>  OK - frustration over. I cleared the cache and ran it again, and all 
>  works as expected. Very bizarre though, considering I started with an 
>  empty cache and have cleared it many times during this debug process.
>
>  Jeremy Burns
>  Class Outfit
>
>  jeremybu...@classoutfit.com
> http://www.classoutfit.com
>
>  On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:
>
> > Thanks. Here's my findings from the test site.
>
> > get_class($this->Order->OrderItem->OrderAddress) returns 
> > 'OrderAddress', so the model is loaded.
>
> > I have littered debug statements throughout 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 
> > $validationErrors['OrderAddress']['field_name'] => 'message').
>
> > I have added some debug statements before the form is rendered:
>
> > - debug($this->validationErrors); => empty
>
> > - debug($this->Order->OrderItem->OrderAddress->validationErrors); => 
> > array of fields and messages as expected
>
> > - debug($validationErrors); => array of fields and messages as expected
>
> > Using the debug toolbar, I can see the variable 
> > $this->validationErrors, which is empty.
>
> > I have also passed $validationErrors as a variable, which is populated 
> > as expected.
>
> > So whilst I can see that validation is failing and errors are being 
> > recorded, they are not being displayed at the front end.
>
> > Here's the thing. This is exactly the same code as is running on my 
> > Mac. On my Mac using the debug toolbar I can see the variable 
> > $this->validationErrors has keys for each model that has validation 
> > errors (e.g. ['OrderAddress']).
>
> > So I'm still stumped.
>
> > I have tried to append items to $this->validationErrors, but none of 
> > them have any effect.
>
> > For additional information, here's how I am constructing my form and 
> > the inputs:
>
> > I have tried all sorts of varieties and each produces the same result:
> > echo $this->Form->create(array('class' => 'order-form')); /*this is the 
> > currently deployed option */
> > echo $this->Form->create('Order', array('class' => 'order-form'));
> > echo $this->Form->create('Order', array('action' => 'your_details', 
> > 'class' => 'order-form'));
> > echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
> > 'class' => 'order-form'));
>
> > Inputs are fairly standard: echo 
> > $this->Form->input('OrderAddress.address1');
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.com
> >http://www.classoutfit.com
>
> > On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
>
> >> Output get_class($this->MyModelThatDontValidate) or call custom model
> >> method to check that models are re

Re: Form validation errors

2010-09-17 Thread Jeremy Burns | Class Outfit
Thanks Dr Loboto. Unfortunately that has no effect.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Sep 2010, at 11:56, Dr. Loboto wrote:

> What if you call create() on this model before save()? Checked code
> related to $persistModel and get lost there.
> 
> On Sep 17, 1:21 pm, Jeremy Burns | Class Outfit
>  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 
>> 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 Outfit
>> 
>> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> 
>> On 17 Sep 2010, at 07:09, Jeremy Burns | Class Outfit wrote:
>> 
>> 
>> 
>>> 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, see the validation messages. 
>>> Resubmit the form - no validation messages. Clear the cache and start again.
>> 
>>> Any clues?
>> 
>>> Jeremy Burns
>>> Class Outfit
>> 
>>> jeremybu...@classoutfit.com
>>> (t) +44 (0) 208 123 3822
>>> (m) +44 (0) 7973 481949
>>> Skype: jeremy_burns
>>> http://www.classoutfit.com
>> 
>>> On 17 Sep 2010, at 06:59, Jeremy Burns | Class Outfit wrote:
>> 
 OK - frustration over. I cleared the cache and ran it again, and all works 
 as expected. Very bizarre though, considering I started with an empty 
 cache and have cleared it many times during this debug process.
>> 
 Jeremy Burns
 Class Outfit
>> 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
>> 
 On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:
>> 
> Thanks. Here's my findings from the test site.
>> 
> get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', 
> so the model is loaded.
>> 
> I have littered debug statements throughout 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 
> $validationErrors['OrderAddress']['field_name'] => 'message').
>> 
> I have added some debug statements before the form is rendered:
>> 
> - debug($this->validationErrors); => empty
>> 
> - debug($this->Order->OrderItem->OrderAddress->validationErrors); => 
> array of fields and messages as expected
>> 
> - debug($validationErrors); => array of fields and messages as expected
>> 
> Using the debug toolbar, I can see the variable $this->validationErrors, 
> which is empty.
>> 
> I have also passed $validationErrors as a variable, which is populated as 
> expected.
>> 
> So whilst I can see that validation is failing and errors are being 
> recorded, they are not being displayed at the front end.
>> 
> Here's the thing. This is exactly the same code as is running on my Mac. 
> On my Mac using the debug toolbar I can see the variable 
> $this->validationErrors has keys for each model that has validation 
> errors (e.g. ['OrderAddress']).
>> 
> So I'm still stumped.
>> 
> I have tried to append items to $this->validationErrors, but none of them 
> have any effect.
>> 
> For additional information, here's how I am constructing my form and the 
> inputs:
>> 
> I have tried all sorts of varieties and each produces the same result:
> echo $this->Form->create(array('class' => 'order-form')); /*this is the 
> currently deployed option */
> echo $this->Form->create('Order', array('class' => 'order-form'));
> echo $this->Form->create('Order', array('action' => 'your_details', 
> 'class' => 'order-form'));
> echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
> 'class' => 'order-form'));
>> 
> Inputs are fairly standard: echo 
> $this->Form->input('OrderAddress.address1');
>> 
> Jeremy Burns
> Class Outfit
>> 
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
>> 
> On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
>> 
>> 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 such errors have true silly reason and 0.1% is for buggy
>> software combin

Re: Form validation errors

2010-09-17 Thread Dr. Loboto
What if you call create() on this model before save()? Checked code
related to $persistModel and get lost there.

On Sep 17, 1:21 pm, Jeremy Burns | Class Outfit
 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 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 Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 17 Sep 2010, at 07:09, Jeremy Burns | Class Outfit wrote:
>
>
>
> > 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, see the validation messages. 
> > Resubmit the form - no validation messages. Clear the cache and start again.
>
> > Any clues?
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.com
> > (t) +44 (0) 208 123 3822
> > (m) +44 (0) 7973 481949
> > Skype: jeremy_burns
> >http://www.classoutfit.com
>
> > On 17 Sep 2010, at 06:59, Jeremy Burns | Class Outfit wrote:
>
> >> OK - frustration over. I cleared the cache and ran it again, and all works 
> >> as expected. Very bizarre though, considering I started with an empty 
> >> cache and have cleared it many times during this debug process.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.com
> >>http://www.classoutfit.com
>
> >> On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:
>
> >>> Thanks. Here's my findings from the test site.
>
> >>> get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', 
> >>> so the model is loaded.
>
> >>> I have littered debug statements throughout 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 
> >>> $validationErrors['OrderAddress']['field_name'] => 'message').
>
> >>> I have added some debug statements before the form is rendered:
>
> >>> - debug($this->validationErrors); => empty
>
> >>> - debug($this->Order->OrderItem->OrderAddress->validationErrors); => 
> >>> array of fields and messages as expected
>
> >>> - debug($validationErrors); => array of fields and messages as expected
>
> >>> Using the debug toolbar, I can see the variable $this->validationErrors, 
> >>> which is empty.
>
> >>> I have also passed $validationErrors as a variable, which is populated as 
> >>> expected.
>
> >>> So whilst I can see that validation is failing and errors are being 
> >>> recorded, they are not being displayed at the front end.
>
> >>> Here's the thing. This is exactly the same code as is running on my Mac. 
> >>> On my Mac using the debug toolbar I can see the variable 
> >>> $this->validationErrors has keys for each model that has validation 
> >>> errors (e.g. ['OrderAddress']).
>
> >>> So I'm still stumped.
>
> >>> I have tried to append items to $this->validationErrors, but none of them 
> >>> have any effect.
>
> >>> For additional information, here's how I am constructing my form and the 
> >>> inputs:
>
> >>> I have tried all sorts of varieties and each produces the same result:
> >>> echo $this->Form->create(array('class' => 'order-form')); /*this is the 
> >>> currently deployed option */
> >>> echo $this->Form->create('Order', array('class' => 'order-form'));
> >>> echo $this->Form->create('Order', array('action' => 'your_details', 
> >>> 'class' => 'order-form'));
> >>> echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
> >>> 'class' => 'order-form'));
>
> >>> Inputs are fairly standard: echo 
> >>> $this->Form->input('OrderAddress.address1');
>
> >>> Jeremy Burns
> >>> Class Outfit
>
> >>> jeremybu...@classoutfit.com
> >>>http://www.classoutfit.com
>
> >>> On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
>
>  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 such errors have true silly reason and 0.1% is for buggy
>  software combination on target server.
>
>  On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
>   wrote:
> > Nope, not correct. All models named correctly - and don't forget 
> > exactly this same code works on my Mac. If your theory was right then 
> > I'd be getting all s

Re: Form validation errors

2010-09-16 Thread Jeremy Burns | Class Outfit
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 anyone shed any more light on this? Is this behaviour 
correct, and what is the impact of leaving out persistModel?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Sep 2010, at 07:09, Jeremy Burns | Class Outfit wrote:

> 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, see the validation messages. 
> Resubmit the form - no validation messages. Clear the cache and start again.
> 
> Any clues?
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> (t) +44 (0) 208 123 3822
> (m) +44 (0) 7973 481949
> Skype: jeremy_burns
> http://www.classoutfit.com
> 
> On 17 Sep 2010, at 06:59, Jeremy Burns | Class Outfit wrote:
> 
>> OK - frustration over. I cleared the cache and ran it again, and all works 
>> as expected. Very bizarre though, considering I started with an empty cache 
>> and have cleared it many times during this debug process.
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.com
>> http://www.classoutfit.com
>> 
>> On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:
>> 
>>> Thanks. Here's my findings from the test site.
>>> 
>>> get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', so 
>>> the model is loaded.
>>> 
>>> I have littered debug statements throughout 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 
>>> $validationErrors['OrderAddress']['field_name'] => 'message').
>>> 
>>> I have added some debug statements before the form is rendered:
>>> 
>>> - debug($this->validationErrors); => empty
>>> 
>>> - debug($this->Order->OrderItem->OrderAddress->validationErrors); => array 
>>> of fields and messages as expected
>>> 
>>> - debug($validationErrors); => array of fields and messages as expected
>>> 
>>> Using the debug toolbar, I can see the variable $this->validationErrors, 
>>> which is empty.
>>> 
>>> I have also passed $validationErrors as a variable, which is populated as 
>>> expected.
>>> 
>>> So whilst I can see that validation is failing and errors are being 
>>> recorded, they are not being displayed at the front end.
>>> 
>>> Here's the thing. This is exactly the same code as is running on my Mac. On 
>>> my Mac using the debug toolbar I can see the variable 
>>> $this->validationErrors has keys for each model that has validation errors 
>>> (e.g. ['OrderAddress']).
>>> 
>>> So I'm still stumped.
>>> 
>>> I have tried to append items to $this->validationErrors, but none of them 
>>> have any effect.
>>> 
>>> For additional information, here's how I am constructing my form and the 
>>> inputs:
>>> 
>>> I have tried all sorts of varieties and each produces the same result:
>>> echo $this->Form->create(array('class' => 'order-form')); /*this is the 
>>> currently deployed option */
>>> echo $this->Form->create('Order', array('class' => 'order-form'));
>>> echo $this->Form->create('Order', array('action' => 'your_details', 'class' 
>>> => 'order-form'));
>>> echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
>>> 'class' => 'order-form'));
>>> 
>>> Inputs are fairly standard: echo 
>>> $this->Form->input('OrderAddress.address1');
>>> 
>>> Jeremy Burns
>>> Class Outfit
>>> 
>>> jeremybu...@classoutfit.com
>>> http://www.classoutfit.com
>>> 
>>> On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
>>> 
 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 such errors have true silly reason and 0.1% is for buggy
 software combination on target server.
 
 On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
  wrote:
> Nope, not correct. All models named correctly - and don't forget exactly 
> this same code works on my Mac. If your theory was right then I'd be 
> getting all sorts of errors and the forms wouldn't pull any data at all. 
> In my case, $this->validationErrors is empty.
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> (t) +44 (0) 208 123 3822
> (m) +44 (0) 7973 481949
> Skype: 

Re: Form validation errors

2010-09-16 Thread Jeremy Burns | Class Outfit
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, see the validation messages. 
Resubmit the form - no validation messages. Clear the cache and start again.

Any clues?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 17 Sep 2010, at 06:59, Jeremy Burns | Class Outfit wrote:

> OK - frustration over. I cleared the cache and ran it again, and all works as 
> expected. Very bizarre though, considering I started with an empty cache and 
> have cleared it many times during this debug process.
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
> 
> On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:
> 
>> Thanks. Here's my findings from the test site.
>> 
>> get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', so 
>> the model is loaded.
>> 
>> I have littered debug statements throughout 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 
>> $validationErrors['OrderAddress']['field_name'] => 'message').
>> 
>> I have added some debug statements before the form is rendered:
>> 
>> - debug($this->validationErrors); => empty
>> 
>> - debug($this->Order->OrderItem->OrderAddress->validationErrors); => array 
>> of fields and messages as expected
>> 
>> - debug($validationErrors); => array of fields and messages as expected
>> 
>> Using the debug toolbar, I can see the variable $this->validationErrors, 
>> which is empty.
>> 
>> I have also passed $validationErrors as a variable, which is populated as 
>> expected.
>> 
>> So whilst I can see that validation is failing and errors are being 
>> recorded, they are not being displayed at the front end.
>> 
>> Here's the thing. This is exactly the same code as is running on my Mac. On 
>> my Mac using the debug toolbar I can see the variable 
>> $this->validationErrors has keys for each model that has validation errors 
>> (e.g. ['OrderAddress']).
>> 
>> So I'm still stumped.
>> 
>> I have tried to append items to $this->validationErrors, but none of them 
>> have any effect.
>> 
>> For additional information, here's how I am constructing my form and the 
>> inputs:
>> 
>> I have tried all sorts of varieties and each produces the same result:
>> echo $this->Form->create(array('class' => 'order-form')); /*this is the 
>> currently deployed option */
>> echo $this->Form->create('Order', array('class' => 'order-form'));
>> echo $this->Form->create('Order', array('action' => 'your_details', 'class' 
>> => 'order-form'));
>> echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
>> 'class' => 'order-form'));
>> 
>> Inputs are fairly standard: echo $this->Form->input('OrderAddress.address1');
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.com
>> http://www.classoutfit.com
>> 
>> On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
>> 
>>> 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 such errors have true silly reason and 0.1% is for buggy
>>> software combination on target server.
>>> 
>>> On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
>>>  wrote:
 Nope, not correct. All models named correctly - and don't forget exactly 
 this same code works on my Mac. If your theory was right then I'd be 
 getting all sorts of errors and the forms wouldn't pull any data at all. 
 In my case, $this->validationErrors is empty.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 (t) +44 (0) 208 123 3822
 (m) +44 (0) 7973 481949
 Skype: jeremy_burnshttp://www.classoutfit.com
 
 On 16 Sep 2010, at 18:30, Dr. Loboto wrote:
 
 
 
> 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 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 messages - I am leaving that to Cake's magic.
 
>> I have moved the site lock, stock and barrel to a remote test server,

Re: Form validation errors

2010-09-16 Thread Jeremy Burns | Class Outfit
OK - frustration over. I cleared the cache and ran it again, and all works as 
expected. Very bizarre though, considering I started with an empty cache and 
have cleared it many times during this debug process.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Sep 2010, at 06:51, Jeremy Burns | Class Outfit wrote:

> Thanks. Here's my findings from the test site.
> 
> get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', so 
> the model is loaded.
> 
> I have littered debug statements throughout 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 
> $validationErrors['OrderAddress']['field_name'] => 'message').
> 
> I have added some debug statements before the form is rendered:
> 
> - debug($this->validationErrors); => empty
> 
> - debug($this->Order->OrderItem->OrderAddress->validationErrors); => array of 
> fields and messages as expected
> 
> - debug($validationErrors); => array of fields and messages as expected
> 
> Using the debug toolbar, I can see the variable $this->validationErrors, 
> which is empty.
> 
> I have also passed $validationErrors as a variable, which is populated as 
> expected.
> 
> So whilst I can see that validation is failing and errors are being recorded, 
> they are not being displayed at the front end.
> 
> Here's the thing. This is exactly the same code as is running on my Mac. On 
> my Mac using the debug toolbar I can see the variable $this->validationErrors 
> has keys for each model that has validation errors (e.g. ['OrderAddress']).
> 
> So I'm still stumped.
> 
> I have tried to append items to $this->validationErrors, but none of them 
> have any effect.
> 
> For additional information, here's how I am constructing my form and the 
> inputs:
> 
> I have tried all sorts of varieties and each produces the same result:
> echo $this->Form->create(array('class' => 'order-form')); /*this is the 
> currently deployed option */
> echo $this->Form->create('Order', array('class' => 'order-form'));
> echo $this->Form->create('Order', array('action' => 'your_details', 'class' 
> => 'order-form'));
> echo $this->Form->create('OrderAddress', array('url' => 'your_details', 
> 'class' => 'order-form'));
> 
> Inputs are fairly standard: echo $this->Form->input('OrderAddress.address1');
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
> 
> On 17 Sep 2010, at 03:46, Dr. Loboto wrote:
> 
>> 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 such errors have true silly reason and 0.1% is for buggy
>> software combination on target server.
>> 
>> On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
>>  wrote:
>>> Nope, not correct. All models named correctly - and don't forget exactly 
>>> this same code works on my Mac. If your theory was right then I'd be 
>>> getting all sorts of errors and the forms wouldn't pull any data at all. In 
>>> my case, $this->validationErrors is empty.
>>> 
>>> Jeremy Burns
>>> Class Outfit
>>> 
>>> jeremybu...@classoutfit.com
>>> (t) +44 (0) 208 123 3822
>>> (m) +44 (0) 7973 481949
>>> Skype: jeremy_burnshttp://www.classoutfit.com
>>> 
>>> On 16 Sep 2010, at 18:30, Dr. Loboto wrote:
>>> 
>>> 
>>> 
 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 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 messages - I am leaving that to Cake's magic.
>>> 
> I have moved the site lock, stock and barrel to a remote test server,
> and - boom - no error messages.
>>> 
> Anyone got any pointers about why this might happen, and what are the
> golden rules to ensure that Cake waves its magic wand appropriately?
>>> 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
>> 
>> Check out the new CakePHP Questions site http://cakeqs.org and help others

Re: Form validation errors

2010-09-16 Thread Jeremy Burns | Class Outfit
Thanks. Here's my findings from the test site.

get_class($this->Order->OrderItem->OrderAddress) returns 'OrderAddress', so the 
model is loaded.

I have littered debug statements throughout 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 
$validationErrors['OrderAddress']['field_name'] => 'message').

I have added some debug statements before the form is rendered:

- debug($this->validationErrors); => empty

- debug($this->Order->OrderItem->OrderAddress->validationErrors); => array of 
fields and messages as expected

- debug($validationErrors); => array of fields and messages as expected

Using the debug toolbar, I can see the variable $this->validationErrors, which 
is empty.

I have also passed $validationErrors as a variable, which is populated as 
expected.

So whilst I can see that validation is failing and errors are being recorded, 
they are not being displayed at the front end.

Here's the thing. This is exactly the same code as is running on my Mac. On my 
Mac using the debug toolbar I can see the variable $this->validationErrors has 
keys for each model that has validation errors (e.g. ['OrderAddress']).

So I'm still stumped.

I have tried to append items to $this->validationErrors, but none of them have 
any effect.

For additional information, here's how I am constructing my form and the inputs:

I have tried all sorts of varieties and each produces the same result:
echo $this->Form->create(array('class' => 'order-form')); /*this is the 
currently deployed option */
echo $this->Form->create('Order', array('class' => 'order-form'));
echo $this->Form->create('Order', array('action' => 'your_details', 'class' => 
'order-form'));
echo $this->Form->create('OrderAddress', array('url' => 'your_details', 'class' 
=> 'order-form'));

Inputs are fairly standard: echo $this->Form->input('OrderAddress.address1');

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Sep 2010, at 03:46, Dr. Loboto wrote:

> 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 such errors have true silly reason and 0.1% is for buggy
> software combination on target server.
> 
> On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
>  wrote:
>> Nope, not correct. All models named correctly - and don't forget exactly 
>> this same code works on my Mac. If your theory was right then I'd be getting 
>> all sorts of errors and the forms wouldn't pull any data at all. In my case, 
>> $this->validationErrors is empty.
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.com
>> (t) +44 (0) 208 123 3822
>> (m) +44 (0) 7973 481949
>> Skype: jeremy_burnshttp://www.classoutfit.com
>> 
>> On 16 Sep 2010, at 18:30, Dr. Loboto wrote:
>> 
>> 
>> 
>>> 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 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 messages - I am leaving that to Cake's magic.
>> 
 I have moved the site lock, stock and barrel to a remote test server,
 and - boom - no error messages.
>> 
 Anyone got any pointers about why this might happen, and what are the
 golden rules to ensure that Cake waves its magic wand appropriately?
>> 
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php?hl=en
> 
> 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 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?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you 

Re: Form validation errors

2010-09-16 Thread Dr. Loboto
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 such errors have true silly reason and 0.1% is for buggy
software combination on target server.

On Sep 17, 12:33 am, Jeremy Burns | Class Outfit
 wrote:
> Nope, not correct. All models named correctly - and don't forget exactly this 
> same code works on my Mac. If your theory was right then I'd be getting all 
> sorts of errors and the forms wouldn't pull any data at all. In my case, 
> $this->validationErrors is empty.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.com
> (t) +44 (0) 208 123 3822
> (m) +44 (0) 7973 481949
> Skype: jeremy_burnshttp://www.classoutfit.com
>
> On 16 Sep 2010, at 18:30, Dr. Loboto wrote:
>
>
>
> > 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 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 messages - I am leaving that to Cake's magic.
>
> >> I have moved the site lock, stock and barrel to a remote test server,
> >> and - boom - no error messages.
>
> >> Anyone got any pointers about why this might happen, and what are the
> >> golden rules to ensure that Cake waves its magic wand appropriately?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Form validation errors

2010-09-16 Thread Jeremy Burns | Class Outfit
Nope, not correct. All models named correctly - and don't forget exactly this 
same code works on my Mac. If your theory was right then I'd be getting all 
sorts of errors and the forms wouldn't pull any data at all. In my case, 
$this->validationErrors is empty.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 16 Sep 2010, at 18:30, Dr. Loboto wrote:

> 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 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 messages - I am leaving that to Cake's magic.
>> 
>> I have moved the site lock, stock and barrel to a remote test server,
>> and - boom - no error messages.
>> 
>> Anyone got any pointers about why this might happen, and what are the
>> golden rules to ensure that Cake waves its magic wand appropriately?
> 
> 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 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?hl=en

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 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?hl=en


Re: Form validation errors

2010-09-16 Thread Dr. Loboto
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 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 messages - I am leaving that to Cake's magic.
>
> I have moved the site lock, stock and barrel to a remote test server,
> and - boom - no error messages.
>
> Anyone got any pointers about why this might happen, and what are the
> golden rules to ensure that Cake waves its magic wand appropriately?

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 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?hl=en


Form validation errors

2010-09-16 Thread Jeremy Burns
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 messages - I am leaving that to Cake's magic.

I have moved the site lock, stock and barrel to a remote test server,
and - boom - no error messages.

Anyone got any pointers about why this might happen, and what are the
golden rules to ensure that Cake waves its magic wand appropriately?

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-18 Thread Nandan Jana

Hi,

I have successfully  implemented the javascript automagic
validation using the plugins. It converts the validation rules written
in the model class in to the js code. so we can write the validation
rules for every table field which is used by a model class.


   Now the question is that , suppose i have change password
form.

   echo $form->create('User', array('action' => 'password'));
   $form->password('adminpwd', array('class' =>
'inputstyle','maxlength' => '15'))  // old password
   $form->password('adminnassword', array('class' =>
'inputstyle','maxlength' => '15')) // new password
   $form->password('admincpassword', array('class' =>
'inputstyle','maxlength' => '15')) // confirm password
   $form->button(' Change Password ',
array('type'=>'submit', 'class' => 'bigbluebutton'))
   echo $form->end();

  'adminpwd' is a TABLE field and i write the validation rules in
the model class:

  class User extends AppModel {

var $validate = array('adminpwd' => array(
'rule' => 'notEmpty',
'message' => 'Password 
can not be left blank'
)

);

   }

   I NEED TO WRITE THE VALIDATION RULES FOR THE 'adminnassword'
AND 'admincpassword' WHICH IS NOT THE FILED FOR THE TABLE.

   I DONT WANT TO MAKE THESE TWO INPUTS VALIDATION  IN THE
CONTROLLER manually. I WANT TO WRITE IT IN THE MODEL CLASS. SO THAT I
CAN USE THE RULES WHEN I use validates() OR WHEN I USE JAVASCRIPT
AUTOMAGIC VALIDATION.

   IF IT POSSIBLE THEN I JUST NEED TO WRITE THE RULES .

   Please can any one give me suggession? HOW TO WRITE RULES FOR
THIS TWO NON DATABASE FILED???

   I use cake 1.3.0

Thanks

On May 17, 11:33 am, Nandan Jana  wrote:
> Hi,
>          I have fixed it. and properly installed the plugins. and i am
> trying to use it for some simple form validation..
>
>          thanks for the help..
>
> On May 17, 10:20 am, Nandan Jana  wrote:
>
>
>
> > Hi,
>
> > I study the linkhttp://github.com/mcurry/js_validate
>
> > and try to use this plugin and got this error
>
> > Warning (512): Method ValidationHelper::rules does not exist [CORE/
> > cake/libs/view/helper.php, line 161]
>
> > i am using cake 1.3.0 version...
>
> > Thanks
>
> > On May 17, 9:49 am, Walther  wrote:
>
> > > Who are you, and why are you talking about facets?
>
> > > On May 16, 2:51 pm, floridapastor  wrote:
>
> > > > I am aware and talking about the FACETS. You should check it out on 
> > > > google
> > > > and please reply. pastor
>
> > > > On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > > > > You know, there is this wonderful little tool available called 'Google
> > > > > Search' use it.
>
> > > > >http://tinyurl.com/33mcrqb
>
> > > > >http://github.com/mcurry/js_validate
> > > > >http://sandbox2.pseudocoder.com/demo/validation
>
> > > > > On May 15, 9:24 am, Nandan Jana  wrote:
> > > > > > Please can any one reply.
>
> > > > > > is it possible to validate a form by javascript in cake 1.3.0 . i 
> > > > > > have
> > > > > > used validation rules in model, but want a client side checking???
>
> > > > > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > > > > Hi,
>
> > > > > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > > > > frame work is must . so i search a lot in google and decided to 
> > > > > > > use
> > > > > > > CAKEPHP.
>
> > > > > > >       I am using the latest stable version 1.3.0 , Try to 
> > > > > > > develope a
> > > > > > > admin panel first and i have learned a lot about model, 
> > > > > > > controller,
> > > > > > > layout, elements . I have developed a login panel , session
> > > > > > > management, template partition using elements . and  now working 
> > > > > > > for
> > > > > > > to comple

Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Nandan Jana
Hi,
 I have fixed it. and properly installed the plugins. and i am
trying to use it for some simple form validation..

 thanks for the help..

On May 17, 10:20 am, Nandan Jana  wrote:
> Hi,
>
> I study the linkhttp://github.com/mcurry/js_validate
>
> and try to use this plugin and got this error
>
> Warning (512): Method ValidationHelper::rules does not exist [CORE/
> cake/libs/view/helper.php, line 161]
>
> i am using cake 1.3.0 version...
>
> Thanks
>
> On May 17, 9:49 am, Walther  wrote:
>
>
>
> > Who are you, and why are you talking about facets?
>
> > On May 16, 2:51 pm, floridapastor  wrote:
>
> > > I am aware and talking about the FACETS. You should check it out on google
> > > and please reply. pastor
>
> > > On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > > > You know, there is this wonderful little tool available called 'Google
> > > > Search' use it.
>
> > > >http://tinyurl.com/33mcrqb
>
> > > >http://github.com/mcurry/js_validate
> > > >http://sandbox2.pseudocoder.com/demo/validation
>
> > > > On May 15, 9:24 am, Nandan Jana  wrote:
> > > > > Please can any one reply.
>
> > > > > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > > > > used validation rules in model, but want a client side checking???
>
> > > > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > > > Hi,
>
> > > > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > > > frame work is must . so i search a lot in google and decided to use
> > > > > > CAKEPHP.
>
> > > > > >       I am using the latest stable version 1.3.0 , Try to develope a
> > > > > > admin panel first and i have learned a lot about model, controller,
> > > > > > layout, elements . I have developed a login panel , session
> > > > > > management, template partition using elements . and  now working for
> > > > > > to complete a full control panel.
>
> > > > > >      i have used validation rules in the model class and the form is
> > > > > > validated by server side.BUT
>
> > > > > > Check out the new CakePHP Questions 
> > > > > > sitehttp://cakeqs.organdhelpothers
> > > > 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 from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com > > > > >  om>For more options, visit this group athttp://
> > > > groups.google.com/group/cake-php?hl=en
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > 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 from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com > > > >  om>For more options, visit this group athttp://
> > > > groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > 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 from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > 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 from this group, send email to
> 

Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Nandan Jana
Hi,

I study the link http://github.com/mcurry/js_validate

and try to use this plugin and got this error

Warning (512): Method ValidationHelper::rules does not exist [CORE/
cake/libs/view/helper.php, line 161]

i am using cake 1.3.0 version...

Thanks

On May 17, 9:49 am, Walther  wrote:
> Who are you, and why are you talking about facets?
>
> On May 16, 2:51 pm, floridapastor  wrote:
>
>
>
> > I am aware and talking about the FACETS. You should check it out on google
> > and please reply. pastor
>
> > On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > > You know, there is this wonderful little tool available called 'Google
> > > Search' use it.
>
> > >http://tinyurl.com/33mcrqb
>
> > >http://github.com/mcurry/js_validate
> > >http://sandbox2.pseudocoder.com/demo/validation
>
> > > On May 15, 9:24 am, Nandan Jana  wrote:
> > > > Please can any one reply.
>
> > > > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > > > used validation rules in model, but want a client side checking???
>
> > > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > > Hi,
>
> > > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > > frame work is must . so i search a lot in google and decided to use
> > > > > CAKEPHP.
>
> > > > >       I am using the latest stable version 1.3.0 , Try to develope a
> > > > > admin panel first and i have learned a lot about model, controller,
> > > > > layout, elements . I have developed a login panel , session
> > > > > management, template partition using elements . and  now working for
> > > > > to complete a full control panel.
>
> > > > >      i have used validation rules in the model class and the form is
> > > > > validated by server side.BUT
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com > > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Nandan Jana
Hi,

I study the link http://github.com/mcurry/js_validate

and try to use this plugin and got this error

Warning (512): Method ValidationHelper::rules does not exist [CORE/
cake/libs/view/helper.php, line 161]

i am using cake 1.3.0 version...

Thanks

On May 17, 9:49 am, Walther  wrote:
> Who are you, and why are you talking about facets?
>
> On May 16, 2:51 pm, floridapastor  wrote:
>
>
>
> > I am aware and talking about the FACETS. You should check it out on google
> > and please reply. pastor
>
> > On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > > You know, there is this wonderful little tool available called 'Google
> > > Search' use it.
>
> > >http://tinyurl.com/33mcrqb
>
> > >http://github.com/mcurry/js_validate
> > >http://sandbox2.pseudocoder.com/demo/validation
>
> > > On May 15, 9:24 am, Nandan Jana  wrote:
> > > > Please can any one reply.
>
> > > > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > > > used validation rules in model, but want a client side checking???
>
> > > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > > Hi,
>
> > > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > > frame work is must . so i search a lot in google and decided to use
> > > > > CAKEPHP.
>
> > > > >       I am using the latest stable version 1.3.0 , Try to develope a
> > > > > admin panel first and i have learned a lot about model, controller,
> > > > > layout, elements . I have developed a login panel , session
> > > > > management, template partition using elements . and  now working for
> > > > > to complete a full control panel.
>
> > > > >      i have used validation rules in the model class and the form is
> > > > > validated by server side.BUT
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com > > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Nandan Jana
Hi,

I study the link http://github.com/mcurry/js_validate

and try to use this plugin and got this error

Warning (512): Method ValidationHelper::rules does not exist [CORE/
cake/libs/view/helper.php, line 161]

i am using cake 1.3.0 version...

Thanks

On May 17, 9:49 am, Walther  wrote:
> Who are you, and why are you talking about facets?
>
> On May 16, 2:51 pm, floridapastor  wrote:
>
>
>
> > I am aware and talking about the FACETS. You should check it out on google
> > and please reply. pastor
>
> > On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > > You know, there is this wonderful little tool available called 'Google
> > > Search' use it.
>
> > >http://tinyurl.com/33mcrqb
>
> > >http://github.com/mcurry/js_validate
> > >http://sandbox2.pseudocoder.com/demo/validation
>
> > > On May 15, 9:24 am, Nandan Jana  wrote:
> > > > Please can any one reply.
>
> > > > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > > > used validation rules in model, but want a client side checking???
>
> > > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > > Hi,
>
> > > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > > frame work is must . so i search a lot in google and decided to use
> > > > > CAKEPHP.
>
> > > > >       I am using the latest stable version 1.3.0 , Try to develope a
> > > > > admin panel first and i have learned a lot about model, controller,
> > > > > layout, elements . I have developed a login panel , session
> > > > > management, template partition using elements . and  now working for
> > > > > to complete a full control panel.
>
> > > > >      i have used validation rules in the model class and the form is
> > > > > validated by server side.BUT
>
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com > > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > 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 from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Walther
Who are you, and why are you talking about facets?

On May 16, 2:51 pm, floridapastor  wrote:
> I am aware and talking about the FACETS. You should check it out on google
> and please reply. pastor
>
> On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:
> > You know, there is this wonderful little tool available called 'Google
> > Search' use it.
>
> >http://tinyurl.com/33mcrqb
>
> >http://github.com/mcurry/js_validate
> >http://sandbox2.pseudocoder.com/demo/validation
>
> > On May 15, 9:24 am, Nandan Jana  wrote:
> > > Please can any one reply.
>
> > > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > > used validation rules in model, but want a client side checking???
>
> > > On May 14, 4:47 pm, Nandan Jana  wrote:
>
> > > > Hi,
>
> > > >       I am a php developer and i never use a frame work. Nowaday's
> > > > frame work is must . so i search a lot in google and decided to use
> > > > CAKEPHP.
>
> > > >       I am using the latest stable version 1.3.0 , Try to develope a
> > > > admin panel first and i have learned a lot about model, controller,
> > > > layout, elements . I have developed a login panel , session
> > > > management, template partition using elements . and  now working for
> > > > to complete a full control panel.
>
> > > >      i have used validation rules in the model class and the form is
> > > > validated by server side.BUT
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > 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 from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group athttp://
> > groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com > >  om>For more options, visit this group athttp://
> > groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread floridapastor
I am aware and talking about the FACETS. You should check it out on google
and please reply. pastor

On Sun, May 16, 2010 at 3:05 AM, Walther  wrote:

> You know, there is this wonderful little tool available called 'Google
> Search' use it.
>
> http://tinyurl.com/33mcrqb
>
> http://github.com/mcurry/js_validate
> http://sandbox2.pseudocoder.com/demo/validation
>
> On May 15, 9:24 am, Nandan Jana  wrote:
> > Please can any one reply.
> >
> > is it possible to validate a form by javascript in cake 1.3.0 . i have
> > used validation rules in model, but want a client side checking???
> >
> > On May 14, 4:47 pm, Nandan Jana  wrote:
> >
> >
> >
> > > Hi,
> >
> > >   I am a php developer and i never use a frame work. Nowaday's
> > > frame work is must . so i search a lot in google and decided to use
> > > CAKEPHP.
> >
> > >   I am using the latest stable version 1.3.0 , Try to develope a
> > > admin panel first and i have learned a lot about model, controller,
> > > layout, elements . I have developed a login panel , session
> > > management, template partition using elements . and  now working for
> > > to complete a full control panel.
> >
> > >  i have used validation rules in the model class and the form is
> > > validated by server side.BUT
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
> >
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
>
> 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-16 Thread Walther
You know, there is this wonderful little tool available called 'Google
Search' use it.

http://tinyurl.com/33mcrqb

http://github.com/mcurry/js_validate
http://sandbox2.pseudocoder.com/demo/validation

On May 15, 9:24 am, Nandan Jana  wrote:
> Please can any one reply.
>
> is it possible to validate a form by javascript in cake 1.3.0 . i have
> used validation rules in model, but want a client side checking???
>
> On May 14, 4:47 pm, Nandan Jana  wrote:
>
>
>
> > Hi,
>
> >       I am a php developer and i never use a frame work. Nowaday's
> > frame work is must . so i search a lot in google and decided to use
> > CAKEPHP.
>
> >       I am using the latest stable version 1.3.0 , Try to develope a
> > admin panel first and i have learned a lot about model, controller,
> > layout, elements . I have developed a login panel , session
> > management, template partition using elements . and  now working for
> > to complete a full control panel.
>
> >      i have used validation rules in the model class and the form is
> > validated by server side.BUT
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-15 Thread Nandan Jana
Please can any one reply.

is it possible to validate a form by javascript in cake 1.3.0 . i have
used validation rules in model, but want a client side checking???

On May 14, 4:47 pm, Nandan Jana  wrote:
> Hi,
>
>       I am a php developer and i never use a frame work. Nowaday's
> frame work is must . so i search a lot in google and decided to use
> CAKEPHP.
>
>       I am using the latest stable version 1.3.0 , Try to develope a
> admin panel first and i have learned a lot about model, controller,
> layout, elements . I have developed a login panel , session
> management, template partition using elements . and  now working for
> to complete a full control panel.
>
>      i have used validation rules in the model class and the form is
> validated by server side.BUT
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Re: Javascript form validation in cakephp 1.3.0

2010-05-15 Thread Nandan Jana
Please can any one reply.

is it possible to validate a form by javascript in cake 1.3.0 . i have
used validation rules in model, but want a client side checking???

On May 14, 4:47 pm, Nandan Jana  wrote:
> Hi,
>
>       I am a php developer and i never use a frame work. Nowaday's
> frame work is must . so i search a lot in google and decided to use
> CAKEPHP.
>
>       I am using the latest stable version 1.3.0 , Try to develope a
> admin panel first and i have learned a lot about model, controller,
> layout, elements . I have developed a login panel , session
> management, template partition using elements . and  now working for
> to complete a full control panel.
>
>      i have used validation rules in the model class and the form is
> validated by server side.BUT
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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 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?hl=en


Javascript form validation in cakephp 1.3.0

2010-05-14 Thread Nandan Jana
Hi,

  I am a php developer and i never use a frame work. Nowaday's
frame work is must . so i search a lot in google and decided to use
CAKEPHP.

  I am using the latest stable version 1.3.0 , Try to develope a
admin panel first and i have learned a lot about model, controller,
layout, elements . I have developed a login panel , session
management, template partition using elements . and  now working for
to complete a full control panel.

 i have used validation rules in the model class and the form is
validated by server side.BUT

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 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?hl=en


Re: redirect to anchor link for form validation

2010-03-20 Thread cricket
To include anchor in a URL, provide the id with the '#' key in the
URL. If your anchor ID is 'foo', you'd use something like:

'controller' => 'xxx', 'action' => 'yyy', '#' => 'foo'

... in the form action. You need to specify it there, and not in a
controller redirect, because the page is not reloaded when there are
validation errors. The form submits to the same URL, and, if there are
NO errors, the request is redirected. Otherwise, the view for that URL
is rendered as requested, only this time displaying validation
errors..

OT FYI: You can use any HTML element with id="foo"; there's no need to
use an A tag (I believe that that use of A is deprecated in HTML5).


On Mar 19, 11:45 pm, Johnny Ferguson  wrote:
> Hi,
>
> I've successfully set up a contact form in cakePHP, and when
> validation rules in my model don't pass, the form is reloaded with all
> my validation errors displayed properly. That battle was won :)
>
> Now for the tricky part.
>
> Can anyone think of a way to not only have the form page reload with
> error messages, but jump to an anchor link at the top of the form if
> errors are present? I'm sure I could use javascript for this, but as
> it stands I can't count on users having javascript enabled. Currently
> when the form reloads with error messages in place, users have to
> scroll down from the top of the page, and I see this as a slight
> problem.
>
> Obviously CakePHP is smart enough to redirect to an appropriate URL
> when validation fails, all I need to do is add #myAnchor to the end of
> that URL somehow. Any ideas?
>
> I've thought of adding a line to my beforeFilter that says something
> like
>
> 1. if we're visiting the form page
> 2. and if some error flag variable is set
> 3. catch the URL somehow
> 4. Add the anchor to the end
>
> But I'm not sure on the specifics of how I'd go about this, and as
> this filter would run before the any page in the controller runs, I
> have concerns about efficiency. Any ideas?
>
> Thanks in advance for your input.

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 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?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


redirect to anchor link for form validation

2010-03-19 Thread Johnny Ferguson
Hi,

I've successfully set up a contact form in cakePHP, and when
validation rules in my model don't pass, the form is reloaded with all
my validation errors displayed properly. That battle was won :)

Now for the tricky part.

Can anyone think of a way to not only have the form page reload with
error messages, but jump to an anchor link at the top of the form if
errors are present? I'm sure I could use javascript for this, but as
it stands I can't count on users having javascript enabled. Currently
when the form reloads with error messages in place, users have to
scroll down from the top of the page, and I see this as a slight
problem.

Obviously CakePHP is smart enough to redirect to an appropriate URL
when validation fails, all I need to do is add #myAnchor to the end of
that URL somehow. Any ideas?

I've thought of adding a line to my beforeFilter that says something
like

1. if we're visiting the form page
2. and if some error flag variable is set
3. catch the URL somehow
4. Add the anchor to the end

But I'm not sure on the specifics of how I'd go about this, and as
this filter would run before the any page in the controller runs, I
have concerns about efficiency. Any ideas?

Thanks in advance for your input.

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 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?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


ajax->submit and form validation

2009-11-30 Thread manojsharma
Hi all,

i am new to cakephp. i have created an application have two
functionality on single form.
i am using cake 1.2.5.

here is my application:

i have customer form. this form contains bellow fields,
1. input box customer name
2. input box customer account no and form for insterting address
3. form for addresses
 inputbox address
 inputbox city
 inputbox state
$ajax->submit()
4. final submit button to save customer form.

now my problem is that i have implemented ajax save functionality but
i m trying to implemented validation on addresses form.

i have created two model form this . customer.php, address.php
i have created only one controller customer_controller.php.into that i
have created one function to handle ajax add,
add_addresses(). and created one final for this evenet.
add_address.ctp.

please tell me what should i do to enable validation address form.

Thanks & Regards

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 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?hl=en


Form validation using multiple Models?

2009-11-28 Thread spheroid
I have a form I'm calling via a specific controller, but will save to
multiple tables. Is there a way to validate against multiple models?

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 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?hl=en


Re: Cake PHP Form validation

2009-11-18 Thread jburns
I'm not entirely sure of all the differences, but what I am learning
is it is best to go "as-Cake-as-possible" to get everything to tie
together. It's worth persevering until you find the solution. One
thing I do know is that if you use $form->input everything is wrapped
up in a div. If you use $form->label etc it isn't which means you have
to do it yourself (more code/markup etc = bad!).

On Nov 18, 3:35 pm, E T  wrote:
> Wow, amazing!! You are a genius.. hehe thank you so much.
>
> It is working now, and yes you are right, I forgot to make changes in the
> view.
>
> BTW, just one curious question.. so to create input fields in form, it is
> better to use '$form->input' rather than something like '$form->password' ?
> What is the difference?
>
> Thank you.
>
>
>
> On Wed, Nov 18, 2009 at 11:09 PM, jburns  wrote:
> > First, change the inputs in the view to:
>
> > echo $form->input('password1', array('label'=>'Password'));
> > echo $form->input('password2', array('label'=>'Please confirm your
> > password'));
>
> > See what happens then.
>
> > On Nov 18, 2:57 pm, E T  wrote:
> > > Hi jburns,
>
> > > Thanks a lot for the reply. I've tried adding your code but it's still
> > not
> > > working.
>
> > > This is what happened:
> > > - if name, email or username is empty, it will give an error message,
> > > something like "Alphabets and numbers only" or "This field cannot be left
> > > blank". However, there is no error message for password1 / password2.
> > > - then I try to input everything. And when I click on save, the page
> > doesn't
> > > load anything. It's still on the same page, and my 'users' table is not
> > > updated.
> > > - if I remove the validation for password1 & password2 in the model's
> > > $validate, it saves the data to db and redirect to other page (working
> > > fine).
>
> > > I'm not sure what's wrong with this.
>
> > > On Wed, Nov 18, 2009 at 10:10 PM, jburns  wrote:
> > > > I forgot something...you need to clear out the password1 and password2
> > > > fields before saving. Use this:
>
> > > > function beforeSave() {
> > > >                if (isset($this->data['User']['password1'])):
> > > >                        $this->data['User']['password'] =
> > > >  Security::hash($this->data
> > > > ['User']['password1'], null, true);
> > > >                        unset($this->data['User']['password1']);
> > > >                endif;
>
> > > >                if (isset($this->data['User']['password2'])):
> > > >                        unset($this->data['User']['password2']);
> > > >                endif;
>
> > > >                return true;
> > > >         }
>
> > > > On Nov 18, 2:06 pm, jburns  wrote:
> > > > > First, a general point. Rather than having separate entries for label
> > > > > and the input, try:
> > > > > echo $form->input('xxx', array('label'=>'Xxxx'));
> > > > > (where xxx is the name of your field and Xxxx is your label).
>
> > > > > This works for me when confirming that passwords match:
>
> > > > > 'password1'=>array(
> > > > >                         'password_1'=>array(
> > > > >                                 'rule'=>'notEmpty',
> > > > >                                 'message'=>'Please enter a
> > password.',
> > > > >                                 'required'=>true,
> > > > >                                 'last'=>true),
> > > > >                         'password_2'=>array(
> > > > >                                 'rule'=>array('between', 8, 20),
> > > > >                                 'message'=>'Your password must be
> > between
> > > > 8 and 20 characters
> > > > > long.'),
> > > > >                 ),
> > > > >                 'password2'=>array(
> > > > >                         'match'=>array(
> > > > >                                 'rule'=>'validatePasswdConfirm',
> > > > >                                 'required'=>true,
> > > > >                                 'allowEmpty'=>false,
> > > > >                                 'message'=>'Your passwords do not
> > match')
> > > > >                 )
>
> > > > > You'll notice that the rule for validating password2 is
> > > > > 'validatePasswdConfirm'. Place this function in your model:
>
> > > > >         function validatePasswdConfirm($data) {
> > > > >                 if ($this->data['User']['passwd'] !==
> > > > $data['passwd_confirm']):
> > > > >                         return false;
> > > > >                 endif;
>
> > > > >                 return true;
> > > > >         }
>
> > > > > For the role field, it looks as if your syntax is a bit muddled. Try
> > > > > something along these lines:
>
> > > > > echo $form->input('role', array('type'=>'select', 'empty'=>true,
> > > > > 'options'=>$roles, 'label'=>'Role'));
>
> > > > > $options is the array that contains the allowed values and can be set
> > > > > in the controller - particularly useful if you are extracting them
> > > > > from a table.
>
> > > > > Hope this helps.
>
> > > > > On Nov 18, 10:44 am, Code Buzz  wrote:
>
> > > > > > Hi all,
>

Re: Cake PHP Form validation

2009-11-18 Thread E T
Wow, amazing!! You are a genius.. hehe thank you so much.

It is working now, and yes you are right, I forgot to make changes in the
view.

BTW, just one curious question.. so to create input fields in form, it is
better to use '$form->input' rather than something like '$form->password' ?
What is the difference?

Thank you.

On Wed, Nov 18, 2009 at 11:09 PM, jburns  wrote:

> First, change the inputs in the view to:
>
> echo $form->input('password1', array('label'=>'Password'));
> echo $form->input('password2', array('label'=>'Please confirm your
> password'));
>
> See what happens then.
>
> On Nov 18, 2:57 pm, E T  wrote:
> > Hi jburns,
> >
> > Thanks a lot for the reply. I've tried adding your code but it's still
> not
> > working.
> >
> > This is what happened:
> > - if name, email or username is empty, it will give an error message,
> > something like "Alphabets and numbers only" or "This field cannot be left
> > blank". However, there is no error message for password1 / password2.
> > - then I try to input everything. And when I click on save, the page
> doesn't
> > load anything. It's still on the same page, and my 'users' table is not
> > updated.
> > - if I remove the validation for password1 & password2 in the model's
> > $validate, it saves the data to db and redirect to other page (working
> > fine).
> >
> > I'm not sure what's wrong with this.
> >
> >
> >
> > On Wed, Nov 18, 2009 at 10:10 PM, jburns  wrote:
> > > I forgot something...you need to clear out the password1 and password2
> > > fields before saving. Use this:
> >
> > > function beforeSave() {
> > >if (isset($this->data['User']['password1'])):
> > >$this->data['User']['password'] =
> > >  Security::hash($this->data
> > > ['User']['password1'], null, true);
> > >unset($this->data['User']['password1']);
> > >endif;
> >
> > >if (isset($this->data['User']['password2'])):
> > >unset($this->data['User']['password2']);
> > >endif;
> >
> > >return true;
> > > }
> >
> > > On Nov 18, 2:06 pm, jburns  wrote:
> > > > First, a general point. Rather than having separate entries for label
> > > > and the input, try:
> > > > echo $form->input('xxx', array('label'=>'Xxxx'));
> > > > (where xxx is the name of your field and Xxxx is your label).
> >
> > > > This works for me when confirming that passwords match:
> >
> > > > 'password1'=>array(
> > > > 'password_1'=>array(
> > > > 'rule'=>'notEmpty',
> > > > 'message'=>'Please enter a
> password.',
> > > > 'required'=>true,
> > > > 'last'=>true),
> > > > 'password_2'=>array(
> > > > 'rule'=>array('between', 8, 20),
> > > > 'message'=>'Your password must be
> between
> > > 8 and 20 characters
> > > > long.'),
> > > > ),
> > > > 'password2'=>array(
> > > > 'match'=>array(
> > > > 'rule'=>'validatePasswdConfirm',
> > > > 'required'=>true,
> > > > 'allowEmpty'=>false,
> > > > 'message'=>'Your passwords do not
> match')
> > > > )
> >
> > > > You'll notice that the rule for validating password2 is
> > > > 'validatePasswdConfirm'. Place this function in your model:
> >
> > > > function validatePasswdConfirm($data) {
> > > > if ($this->data['User']['passwd'] !==
> > > $data['passwd_confirm']):
> > > > return false;
> > > > endif;
> >
> > > > return true;
> > > > }
> >
> > > > For the role field, it looks as if your syntax is a bit muddled. Try
> > > > something along these lines:
> >
> > > > echo $form->input('role', array('type'=>'select', 'empty'=>true,
> > > > 'options'=>$roles, 'label'=>'Role'));
> >
> > > > $options is the array that contains the allowed values and can be set
> > > > in the controller - particularly useful if you are extracting them
> > > > from a table.
> >
> > > > Hope this helps.
> >
> > > > On Nov 18, 10:44 am, Code Buzz  wrote:
> >
> > > > > Hi all,
> >
> > > > > I'm a newbie at cakePHP, and still at the learning phase.
> >
> > > > > I was trying to make a user management system with cakephp, where
> we
> > > > > can add/edit/delete user. But I am stuck in the validation part. I
> > > > > hope someone can help me on this.
> >
> > > > > I have this 'users' table:
> > > > > =
> > > > > CREATE TABLE `users` (
> > > > >   `id` int(11) NOT NULL AUTO_INCREMENT,
> > > > >   `username` varchar(255) NOT NULL,
> > > > >   `password` varchar(32) NOT NULL,
> > > > >   `email` varchar(80) NOT NULL,
>

Re: Cake PHP Form validation

2009-11-18 Thread jburns
First, change the inputs in the view to:

echo $form->input('password1', array('label'=>'Password'));
echo $form->input('password2', array('label'=>'Please confirm your
password'));

See what happens then.

On Nov 18, 2:57 pm, E T  wrote:
> Hi jburns,
>
> Thanks a lot for the reply. I've tried adding your code but it's still not
> working.
>
> This is what happened:
> - if name, email or username is empty, it will give an error message,
> something like "Alphabets and numbers only" or "This field cannot be left
> blank". However, there is no error message for password1 / password2.
> - then I try to input everything. And when I click on save, the page doesn't
> load anything. It's still on the same page, and my 'users' table is not
> updated.
> - if I remove the validation for password1 & password2 in the model's
> $validate, it saves the data to db and redirect to other page (working
> fine).
>
> I'm not sure what's wrong with this.
>
>
>
> On Wed, Nov 18, 2009 at 10:10 PM, jburns  wrote:
> > I forgot something...you need to clear out the password1 and password2
> > fields before saving. Use this:
>
> > function beforeSave() {
> >                if (isset($this->data['User']['password1'])):
> >                        $this->data['User']['password'] =
> >  Security::hash($this->data
> > ['User']['password1'], null, true);
> >                        unset($this->data['User']['password1']);
> >                endif;
>
> >                if (isset($this->data['User']['password2'])):
> >                        unset($this->data['User']['password2']);
> >                endif;
>
> >                return true;
> >         }
>
> > On Nov 18, 2:06 pm, jburns  wrote:
> > > First, a general point. Rather than having separate entries for label
> > > and the input, try:
> > > echo $form->input('xxx', array('label'=>'Xxxx'));
> > > (where xxx is the name of your field and Xxxx is your label).
>
> > > This works for me when confirming that passwords match:
>
> > > 'password1'=>array(
> > >                         'password_1'=>array(
> > >                                 'rule'=>'notEmpty',
> > >                                 'message'=>'Please enter a password.',
> > >                                 'required'=>true,
> > >                                 'last'=>true),
> > >                         'password_2'=>array(
> > >                                 'rule'=>array('between', 8, 20),
> > >                                 'message'=>'Your password must be between
> > 8 and 20 characters
> > > long.'),
> > >                 ),
> > >                 'password2'=>array(
> > >                         'match'=>array(
> > >                                 'rule'=>'validatePasswdConfirm',
> > >                                 'required'=>true,
> > >                                 'allowEmpty'=>false,
> > >                                 'message'=>'Your passwords do not match')
> > >                 )
>
> > > You'll notice that the rule for validating password2 is
> > > 'validatePasswdConfirm'. Place this function in your model:
>
> > >         function validatePasswdConfirm($data) {
> > >                 if ($this->data['User']['passwd'] !==
> > $data['passwd_confirm']):
> > >                         return false;
> > >                 endif;
>
> > >                 return true;
> > >         }
>
> > > For the role field, it looks as if your syntax is a bit muddled. Try
> > > something along these lines:
>
> > > echo $form->input('role', array('type'=>'select', 'empty'=>true,
> > > 'options'=>$roles, 'label'=>'Role'));
>
> > > $options is the array that contains the allowed values and can be set
> > > in the controller - particularly useful if you are extracting them
> > > from a table.
>
> > > Hope this helps.
>
> > > On Nov 18, 10:44 am, Code Buzz  wrote:
>
> > > > Hi all,
>
> > > > I'm a newbie at cakePHP, and still at the learning phase.
>
> > > > I was trying to make a user management system with cakephp, where we
> > > > can add/edit/delete user. But I am stuck in the validation part. I
> > > > hope someone can help me on this.
>
> > > > I have this 'users' table:
> > > > =
> > > > CREATE TABLE `users` (
> > > >   `id` int(11) NOT NULL AUTO_INCREMENT,
> > > >   `username` varchar(255) NOT NULL,
> > > >   `password` varchar(32) NOT NULL,
> > > >   `email` varchar(80) NOT NULL,
> > > >   `name` varchar(255) NOT NULL DEFAULT '',
> > > >   `designation` varchar(255) DEFAULT NULL,
> > > >   `role` varchar(30) NOT NULL,
> > > >   `print_perm` int(1) NOT NULL,
> > > >   `disabled` int(1) NOT NULL DEFAULT '0',
> > > >   PRIMARY KEY (`id`)
> > > > ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
>
> > > > and I have this form to add the user:
> > > > =
> > > >   echo $form->create('User');
> > > >   echo $form->input('username');
> > > >   echo $form->input('email');
> > > >   echo $form->input('name');
> > > >   echo $form->input('designation');
> > > >   $optio

Re: Cake PHP Form validation

2009-11-18 Thread E T
Hi jburns,

Thanks a lot for the reply. I've tried adding your code but it's still not
working.

This is what happened:
- if name, email or username is empty, it will give an error message,
something like "Alphabets and numbers only" or "This field cannot be left
blank". However, there is no error message for password1 / password2.
- then I try to input everything. And when I click on save, the page doesn't
load anything. It's still on the same page, and my 'users' table is not
updated.
- if I remove the validation for password1 & password2 in the model's
$validate, it saves the data to db and redirect to other page (working
fine).

I'm not sure what's wrong with this.

On Wed, Nov 18, 2009 at 10:10 PM, jburns  wrote:

> I forgot something...you need to clear out the password1 and password2
> fields before saving. Use this:
>
> function beforeSave() {
>if (isset($this->data['User']['password1'])):
>$this->data['User']['password'] =
>  Security::hash($this->data
> ['User']['password1'], null, true);
>unset($this->data['User']['password1']);
>endif;
>
>if (isset($this->data['User']['password2'])):
>unset($this->data['User']['password2']);
>endif;
>
>return true;
> }
>
> On Nov 18, 2:06 pm, jburns  wrote:
> > First, a general point. Rather than having separate entries for label
> > and the input, try:
> > echo $form->input('xxx', array('label'=>'Xxxx'));
> > (where xxx is the name of your field and Xxxx is your label).
> >
> > This works for me when confirming that passwords match:
> >
> > 'password1'=>array(
> > 'password_1'=>array(
> > 'rule'=>'notEmpty',
> > 'message'=>'Please enter a password.',
> > 'required'=>true,
> > 'last'=>true),
> > 'password_2'=>array(
> > 'rule'=>array('between', 8, 20),
> > 'message'=>'Your password must be between
> 8 and 20 characters
> > long.'),
> > ),
> > 'password2'=>array(
> > 'match'=>array(
> > 'rule'=>'validatePasswdConfirm',
> > 'required'=>true,
> > 'allowEmpty'=>false,
> > 'message'=>'Your passwords do not match')
> > )
> >
> > You'll notice that the rule for validating password2 is
> > 'validatePasswdConfirm'. Place this function in your model:
> >
> > function validatePasswdConfirm($data) {
> > if ($this->data['User']['passwd'] !==
> $data['passwd_confirm']):
> > return false;
> > endif;
> >
> > return true;
> > }
> >
> > For the role field, it looks as if your syntax is a bit muddled. Try
> > something along these lines:
> >
> > echo $form->input('role', array('type'=>'select', 'empty'=>true,
> > 'options'=>$roles, 'label'=>'Role'));
> >
> > $options is the array that contains the allowed values and can be set
> > in the controller - particularly useful if you are extracting them
> > from a table.
> >
> > Hope this helps.
> >
> > On Nov 18, 10:44 am, Code Buzz  wrote:
> >
> >
> >
> > > Hi all,
> >
> > > I'm a newbie at cakePHP, and still at the learning phase.
> >
> > > I was trying to make a user management system with cakephp, where we
> > > can add/edit/delete user. But I am stuck in the validation part. I
> > > hope someone can help me on this.
> >
> > > I have this 'users' table:
> > > =
> > > CREATE TABLE `users` (
> > >   `id` int(11) NOT NULL AUTO_INCREMENT,
> > >   `username` varchar(255) NOT NULL,
> > >   `password` varchar(32) NOT NULL,
> > >   `email` varchar(80) NOT NULL,
> > >   `name` varchar(255) NOT NULL DEFAULT '',
> > >   `designation` varchar(255) DEFAULT NULL,
> > >   `role` varchar(30) NOT NULL,
> > >   `print_perm` int(1) NOT NULL,
> > >   `disabled` int(1) NOT NULL DEFAULT '0',
> > >   PRIMARY KEY (`id`)
> > > ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
> >
> > > and I have this form to add the user:
> > > =
> > >   echo $form->create('User');
> > >   echo $form->input('username');
> > >   echo $form->input('email');
> > >   echo $form->input('name');
> > >   echo $form->input('designation');
> > >   $options=array('admin'=>'Administrator','user'=>'User');
> > >   echo $form->label('Role');
> > >   echo $form->select('role',$options);
> > >   echo $form->label('Password');
> > >   echo $form->password('password1');
> > >   echo $form->label('Confirm Password');
> > >   echo $form->password('password2');
> > >   echo "";
> > >   echo $form->checkbox('print_perm');
> > >   echo " Can Print?";
> > >   echo $

Re: Cake PHP Form validation

2009-11-18 Thread jburns
I forgot something...you need to clear out the password1 and password2
fields before saving. Use this:

function beforeSave() {
if (isset($this->data['User']['password1'])):
$this->data['User']['password'] =  
Security::hash($this->data
['User']['password1'], null, true);
unset($this->data['User']['password1']);
endif;

if (isset($this->data['User']['password2'])):
unset($this->data['User']['password2']);
endif;

return true;
}

On Nov 18, 2:06 pm, jburns  wrote:
> First, a general point. Rather than having separate entries for label
> and the input, try:
> echo $form->input('xxx', array('label'=>'Xxxx'));
> (where xxx is the name of your field and Xxxx is your label).
>
> This works for me when confirming that passwords match:
>
> 'password1'=>array(
>                         'password_1'=>array(
>                                 'rule'=>'notEmpty',
>                                 'message'=>'Please enter a password.',
>                                 'required'=>true,
>                                 'last'=>true),
>                         'password_2'=>array(
>                                 'rule'=>array('between', 8, 20),
>                                 'message'=>'Your password must be between 8 
> and 20 characters
> long.'),
>                 ),
>                 'password2'=>array(
>                         'match'=>array(
>                                 'rule'=>'validatePasswdConfirm',
>                                 'required'=>true,
>                                 'allowEmpty'=>false,
>                                 'message'=>'Your passwords do not match')
>                 )
>
> You'll notice that the rule for validating password2 is
> 'validatePasswdConfirm'. Place this function in your model:
>
>         function validatePasswdConfirm($data) {
>                 if ($this->data['User']['passwd'] !== 
> $data['passwd_confirm']):
>                         return false;
>                 endif;
>
>                 return true;
>         }
>
> For the role field, it looks as if your syntax is a bit muddled. Try
> something along these lines:
>
> echo $form->input('role', array('type'=>'select', 'empty'=>true,
> 'options'=>$roles, 'label'=>'Role'));
>
> $options is the array that contains the allowed values and can be set
> in the controller - particularly useful if you are extracting them
> from a table.
>
> Hope this helps.
>
> On Nov 18, 10:44 am, Code Buzz  wrote:
>
>
>
> > Hi all,
>
> > I'm a newbie at cakePHP, and still at the learning phase.
>
> > I was trying to make a user management system with cakephp, where we
> > can add/edit/delete user. But I am stuck in the validation part. I
> > hope someone can help me on this.
>
> > I have this 'users' table:
> > =
> > CREATE TABLE `users` (
> >   `id` int(11) NOT NULL AUTO_INCREMENT,
> >   `username` varchar(255) NOT NULL,
> >   `password` varchar(32) NOT NULL,
> >   `email` varchar(80) NOT NULL,
> >   `name` varchar(255) NOT NULL DEFAULT '',
> >   `designation` varchar(255) DEFAULT NULL,
> >   `role` varchar(30) NOT NULL,
> >   `print_perm` int(1) NOT NULL,
> >   `disabled` int(1) NOT NULL DEFAULT '0',
> >   PRIMARY KEY (`id`)
> > ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
>
> > and I have this form to add the user:
> > =
> >   echo $form->create('User');
> >   echo $form->input('username');
> >   echo $form->input('email');
> >   echo $form->input('name');
> >   echo $form->input('designation');
> >   $options=array('admin'=>'Administrator','user'=>'User');
> >   echo $form->label('Role');
> >   echo $form->select('role',$options);
> >   echo $form->label('Password');
> >   echo $form->password('password1');
> >   echo $form->label('Confirm Password');
> >   echo $form->password('password2');
> >   echo "";
> >   echo $form->checkbox('print_perm');
> >   echo " Can Print?";
> >   echo $form->input('id', array('type'=>'hidden'));
> >   echo $form->button('Save', array('type' => 'submit'));
> >   echo $form->button('Reset', array('type' => 'reset'));
> >   echo $form->end();
>
> > I put this validation on my model:
> > =
> >     var $validate = array(
> >         'username' => array(
> >             'alphaNumeric' => array(
> >                 'rule' => 'alphaNumeric',
> >                 'message' => 'Alphabets and numbers only'
> >                 ),
> >         ),
> >         'email' => 'email',
> >         'name' => VALID_NOT_EMPTY,
> >         'role' => VALID_NOT_EMPTY,
> >         'password' => VALID_NOT_EMPTY,
> >     );
>
> > it is not working for the 'role' and 'password' field. I have
> > 'password1' and 'password2' in the view, while my db field is
> > 'password'. I'm not sure what to do to make this work.
>
> > Any help is appreciated. Thank you.

--

You received this messa

Re: Cake PHP Form validation

2009-11-18 Thread jburns
First, a general point. Rather than having separate entries for label
and the input, try:
echo $form->input('xxx', array('label'=>'Xxxx'));
(where xxx is the name of your field and Xxxx is your label).

This works for me when confirming that passwords match:

'password1'=>array(
'password_1'=>array(
'rule'=>'notEmpty',
'message'=>'Please enter a password.',
'required'=>true,
'last'=>true),
'password_2'=>array(
'rule'=>array('between', 8, 20),
'message'=>'Your password must be between 8 and 
20 characters
long.'),
),
'password2'=>array(
'match'=>array(
'rule'=>'validatePasswdConfirm',
'required'=>true,
'allowEmpty'=>false,
'message'=>'Your passwords do not match')
)

You'll notice that the rule for validating password2 is
'validatePasswdConfirm'. Place this function in your model:

function validatePasswdConfirm($data) {
if ($this->data['User']['passwd'] !== $data['passwd_confirm']):
return false;
endif;

return true;
}

For the role field, it looks as if your syntax is a bit muddled. Try
something along these lines:

echo $form->input('role', array('type'=>'select', 'empty'=>true,
'options'=>$roles, 'label'=>'Role'));

$options is the array that contains the allowed values and can be set
in the controller - particularly useful if you are extracting them
from a table.

Hope this helps.

On Nov 18, 10:44 am, Code Buzz  wrote:
> Hi all,
>
> I'm a newbie at cakePHP, and still at the learning phase.
>
> I was trying to make a user management system with cakephp, where we
> can add/edit/delete user. But I am stuck in the validation part. I
> hope someone can help me on this.
>
> I have this 'users' table:
> =
> CREATE TABLE `users` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `username` varchar(255) NOT NULL,
>   `password` varchar(32) NOT NULL,
>   `email` varchar(80) NOT NULL,
>   `name` varchar(255) NOT NULL DEFAULT '',
>   `designation` varchar(255) DEFAULT NULL,
>   `role` varchar(30) NOT NULL,
>   `print_perm` int(1) NOT NULL,
>   `disabled` int(1) NOT NULL DEFAULT '0',
>   PRIMARY KEY (`id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
>
> and I have this form to add the user:
> =
>   echo $form->create('User');
>   echo $form->input('username');
>   echo $form->input('email');
>   echo $form->input('name');
>   echo $form->input('designation');
>   $options=array('admin'=>'Administrator','user'=>'User');
>   echo $form->label('Role');
>   echo $form->select('role',$options);
>   echo $form->label('Password');
>   echo $form->password('password1');
>   echo $form->label('Confirm Password');
>   echo $form->password('password2');
>   echo "";
>   echo $form->checkbox('print_perm');
>   echo " Can Print?";
>   echo $form->input('id', array('type'=>'hidden'));
>   echo $form->button('Save', array('type' => 'submit'));
>   echo $form->button('Reset', array('type' => 'reset'));
>   echo $form->end();
>
> I put this validation on my model:
> =
>     var $validate = array(
>         'username' => array(
>             'alphaNumeric' => array(
>                 'rule' => 'alphaNumeric',
>                 'message' => 'Alphabets and numbers only'
>                 ),
>         ),
>         'email' => 'email',
>         'name' => VALID_NOT_EMPTY,
>         'role' => VALID_NOT_EMPTY,
>         'password' => VALID_NOT_EMPTY,
>     );
>
> it is not working for the 'role' and 'password' field. I have
> 'password1' and 'password2' in the view, while my db field is
> 'password'. I'm not sure what to do to make this work.
>
> Any help is appreciated. Thank you.

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
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?hl=.




Cake PHP Form validation

2009-11-18 Thread Code Buzz
Hi all,

I'm a newbie at cakePHP, and still at the learning phase.

I was trying to make a user management system with cakephp, where we
can add/edit/delete user. But I am stuck in the validation part. I
hope someone can help me on this.

I have this 'users' table:
=
CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(80) NOT NULL,
  `name` varchar(255) NOT NULL DEFAULT '',
  `designation` varchar(255) DEFAULT NULL,
  `role` varchar(30) NOT NULL,
  `print_perm` int(1) NOT NULL,
  `disabled` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

and I have this form to add the user:
=
  echo $form->create('User');
  echo $form->input('username');
  echo $form->input('email');
  echo $form->input('name');
  echo $form->input('designation');
  $options=array('admin'=>'Administrator','user'=>'User');
  echo $form->label('Role');
  echo $form->select('role',$options);
  echo $form->label('Password');
  echo $form->password('password1');
  echo $form->label('Confirm Password');
  echo $form->password('password2');
  echo "";
  echo $form->checkbox('print_perm');
  echo " Can Print?";
  echo $form->input('id', array('type'=>'hidden'));
  echo $form->button('Save', array('type' => 'submit'));
  echo $form->button('Reset', array('type' => 'reset'));
  echo $form->end();

I put this validation on my model:
=
var $validate = array(
'username' => array(
'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Alphabets and numbers only'
),
),
'email' => 'email',
'name' => VALID_NOT_EMPTY,
'role' => VALID_NOT_EMPTY,
'password' => VALID_NOT_EMPTY,
);

it is not working for the 'role' and 'password' field. I have
'password1' and 'password2' in the view, while my db field is
'password'. I'm not sure what to do to make this work.

Any help is appreciated. Thank you.

--

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-...@googlegroups.com.
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?hl=.




Re: Form Validation - Problems with Umlauts and Passwords

2009-07-08 Thread Robert P

1. Before rendering the view it's a good idea to unset any sensitive
information in Controller::$data. This way, the form will get to
display the errors and the password fields will stay empty.

2. The error comes from the call to:

FormHelper::error()  =>  h()  =>  htmlspecialchars($this->validate
['email']['message'], ENT_QUOTES, 'UTF-8');

A potential workaround is to manually output the error message without
escaping. Something like:

$form->input('email', array('error' => false));
$form->error('email', 'Bad E-Mail - Ungültige EMail', array
('escape' => false));

On Jul 8, 4:26 pm, Taff  wrote:
> I'm rather new to cakePHP and am experimenting with it, in the hope
> that it will be the framework I will use for a multilingual site I
> have been tasked with. The site will be available in German and
> English.
>
> Problem 1: When the form doesn't validate correctly it is reloaded
> with the password already hashed. Presumably the password will then be
> "rehashed" upon saving, meaning the person can no longer login? Is
> there a workaround or solution available?
>
> Problem 2: I am also playing with $validate and have the following in
> my model:
>
> var $validate = array(
>         'email' => array(
>         'rule' => 'email',
>         'message' => 'Bad E-Mail - Ungültige EMail'
>         )
>     );
>
> Unfortunately the ü isn't being displayed correctly, and ü also
> doesn't work (The ampersand is being encoded). Either the entire error
> message is not being displayed or the encoding is incorrect.
>
> Configure::write('App.encoding', 'UTF-8');
>
> is in the core and the header of the document looks like
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
>         
>
> Where am I going wrong?
> Thanks,
> Taff
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form Validation - Problems with Umlauts and Passwords

2009-07-08 Thread Taff

I'm rather new to cakePHP and am experimenting with it, in the hope
that it will be the framework I will use for a multilingual site I
have been tasked with. The site will be available in German and
English.

Problem 1: When the form doesn't validate correctly it is reloaded
with the password already hashed. Presumably the password will then be
"rehashed" upon saving, meaning the person can no longer login? Is
there a workaround or solution available?

Problem 2: I am also playing with $validate and have the following in
my model:

var $validate = array(
'email' => array(
'rule' => 'email',
'message' => 'Bad E-Mail - Ungültige EMail'
)
);

Unfortunately the ü isn't being displayed correctly, and ü also
doesn't work (The ampersand is being encoded). Either the entire error
message is not being displayed or the encoding is incorrect.

Configure::write('App.encoding', 'UTF-8');

is in the core and the header of the document looks like


http://www.w3.org/1999/xhtml";>



Where am I going wrong?
Thanks,
Taff
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)

2009-07-04 Thread jperras

http://book.cakephp.org/view/139/comparison

-j.

On Jul 2, 5:13 pm, hoyos  wrote:
> Hey,
>
> Simple question, is there a built-in form validation function to
> validate that a field DOES NOT EQUAL a certain value?
>
> For example: 'password' => array( 'rule' => array('notEqualTo',
> 'password'), 'message'=>'Please choose a more unique password.');
>
> Thanks,
> Andy
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)

2009-07-02 Thread Paul

No built in method no, but you could pretty easy put your own method in your
model(s) and just use that as your validation rule.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of hoyos
Sent: Friday, 3 July 2009 9:13 a.m.
To: CakePHP
Subject: Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)


Hey,

Simple question, is there a built-in form validation function to
validate that a field DOES NOT EQUAL a certain value?

For example: 'password' => array( 'rule' => array('notEqualTo',
'password'), 'message'=>'Please choose a more unique password.');

Thanks,
Andy


__ Information from ESET NOD32 Antivirus, version of virus signature
database 4206 (20090701) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


 

__ Information from ESET NOD32 Antivirus, version of virus signature
database 4211 (20090702) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 


--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)

2009-07-02 Thread hoyos

Hey,

Simple question, is there a built-in form validation function to
validate that a field DOES NOT EQUAL a certain value?

For example: 'password' => array( 'rule' => array('notEqualTo',
'password'), 'message'=>'Please choose a more unique password.');

Thanks,
Andy
--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: form validation using model

2009-06-19 Thread Marcelo Andrade

On Thu, Jun 18, 2009 at 12:21 AM, puneetratan wrote:
> (..)
>
> and one more thing, that when i use $form->input then validations
> appears but when i use $form->text then validations does not appear,

I see you solved it.  But just for reference, $form->text
doesn't provide validation messages.  So you have to
put $form->error() near it.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

--~--~-~--~~~---~--~~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   3   >