Also try a save() before checking for validation errors.

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 17 Feb 2011, at 11:44, Jeremy Burns | Class Outfit wrote:

> Try something for me...
> 
> debug($this->Incoming->validates());
> 
> die(debug($this->Incoming->validationErrors));
> 
> ...rather than checking for true or false.
> 
> Jeremy Burns
> Class Outfit
> 
> [email protected]
> http://www.classoutfit.com
> 
> On 17 Feb 2011, at 11:40, Tapan Kumar Thapa wrote:
> 
>> Still not working. :-(
>> 
>> My Url: 
>> http://localhost/cakephp/incomings/request/msisdn:/operator:AIRTEL/circle:DELHI
>> 
>> My Controller:
>> 
>> <?php
>> 
>> class IncomingsController extends AppController {
>> 
>>     var $name = 'Incomings';
>> 
>>     function request() {
>>         $this->Incoming->set(array(
>>             'Incoming' => $this->params['named']
>>                 ));
>>         //$this->Incoming->set($this->params['named']);
>>         if ($this->Incoming->validates()==TRUE) {
>>             $this->Session->setFlash("Correct");
>>         } else {
>>             $this->Session->setFlash("Incorrect");
>>         }
>>     }
>> 
>> }
>> 
>> ?>
>> 
>> My Model:
>> 
>> <?php
>> 
>> class Incoming extends AppModel {
>> 
>>     var $name = 'Incoming';
>>     var $validate = array(
>>         'msisdn' => array(
>>             'required' => true,
>>             'allowEmpty' => false,
>>             'rule' => 'numeric',
>>             'message' => 'Please enter a valid msisdn',
>>         ));
>> 
>> }
>> 
>> ?>
>> 
>> Please suggest.
>> 
>> Regards
>> Tapan Thapa
>> India
>> 
>> On Thu, Feb 17, 2011 at 4:58 PM, John Andersen <[email protected]> 
>> wrote:
>> When you are setting the model data using the set() method, then you
>> should provide it with at standard structure, not just the value of
>> the msisdn parameter.
>> 
>> [code example]
>> $this->Incoming->set( array(
>>   'Incoming' => $this->params['named']
>> ) );
>> [/code example]
>> 
>> Enjoy,
>>   John
>> 
>> On 17 Feb., 12:09, Tapan Kumar Thapa <[email protected]>
>> wrote:
>> > I am dam got stuck here.
>> >
>> > Can some one suggest anything?
>> >
>> > BR
>> > Tapan Thapa
>> >
>> > On Thu, Feb 17, 2011 at 10:02 AM, Tapan Kumar Thapa <
>> >
>> >
>> [snip]
>> 
>> --
>> 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
>> [email protected] 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
>> [email protected] 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
> [email protected] 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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to