Hello,

I have an edit action in controller which is not validating
correctly.  The same validation works when a user registers, but not
on the edit, when I attempt to validate the data on edit($this-
>Attendeeregistration->validates($this->data), I get the Notice
(Notice: Undefined index: Attendeeregistration in app\models
\attendeeregistration.php on line 20).

I appreciate very much any help offered.

Thanks,

The model:
class Attendeeregistration extends AppModel
{
        var $name = 'Attendeeregistration';

        var $validate = array(
                                        'FirstName' => VALID_NOT_EMPTY,
                                        'LastName' => VALID_NOT_EMPTY,
                                        'Address' => VALID_NOT_EMPTY,
                                        'City' => VALID_NOT_EMPTY,
                                        'ZipCode' => '/^.{5,15}$/',
                                        'Telephone' => '/^.{7,25}$/',
                                        'occupation_id' => VALID_NOT_EMPTY,
                                        'Company' => VALID_NOT_EMPTY,
                                        'Email' => VALID_EMAIL
                                        );

        function validates()
        {
                $attendee = $this->data['Attendeeregistration'];
                //if($attendee['occupation_id'] = '') {
                        //$this->invalidate('occupation_id');
                        //}
                if(empty($attendee['OtherOccupation']) &&
($attendee['occupation_id'] == '20') ) {
                        $this->invalidate('OtherOccupation');
                        }
                if(empty($attendee['PurchDecision'])) {
                        $this->invalidate('PurchDecision');
                        }
                if($attendee['EmailVerify'] != $attendee['Email']) {
                        $this->invalidate('EmailVerify');
                        }

                $errors = $this->invalidFields();
                return count($errors) == 0;

        }

}

and the action in controller:

if($this->Attendeeregistration->validates($this->data))
                        {
                                $this->cleanUpFields();

                                $d = $this->data['Attendeeregistration'];
                                $id = $r['id'];

                                $query = 
$this->Attendeeregistration->query(removed update query
for brevity/this works fine);
                                if($query)
                                {
                                        $this->Session->setFlash('successful 
save');
                                }
                        }


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

Reply via email to