thanks for reply,
    but sorry to say that it doesn't work.actually my model looks like
as follows


employee.php
class Employee extends AppModel {
                var $name = "Employee";
                var $actsAs   = array('extendAssociations');

        var $hasAndBelongsToMany = array(
                'Accreditation' => array('className'    => 'Accreditation',
                                  'joinTable'   =>
'employees_accreditations',
                                                                        'with'  
        =>'EmployeeAccreditation',
                                     'foreignKey'   => 'employee_id',
                                     'associationForeignKey'=>
'accreditation_id',
                                     'conditions'   => '',
                                     'order'        => '',
                                     'limit'        => '',
                                     'unique'       => true,
                                     'finderQuery'  => '',
                                     'deleteQuery'  => '',
                                 )
                               ); ...........



controller
<?php
        class EmployeesController extends AppController {
                var $name = 'Employees';
                var $helpers = array('Html', 'Form','Javascript');
            var $components = array('RequestHandler','Tablefilter');

                function index() {
                 if(!empty($this->data)) {
                        $parsedConditions = 
$this->Employee->parseCriteria($this->data);
                        $this->paginate['Employee'] = array(
                         'conditions' => $parsedConditions,
                         'fields' => 'Employee.id, Employee.first_name, 
Employee.surname'
                         );
                 }
                 $pagecontents = $this->paginate();
                 if (empty($pagecontents)) {
                  $this->Session->setFlash("No Employee matches the search 
Criteria
Please re-enter the search criteria again!!");
                 }
                 else {
                 $this->Employee->recursive = 0;
                 $this->set("employees",$this->paginate());
                 }
          }



                function edit($id = null) {
                        if(!empty($this->data)) {
                              if($this->Employee->save($this->data)) {
                                        $this->Session->setFlash('Employee 
information has been
updated');
                                  }
                                  else {
                                        $this->Session->setFlash('Employee 
Information cannot be
updated');
                                  }
                                }
                                else {
                                        $this->Employee->EmployeeAccreditation-
>bindModel(array('belongsTo' => array('Employee', 'Accreditation')));
                                        $this->data = 
$this->Employee->EmployeeAccreditation-
>find('all',array('conditions'=>array('Employee.id'=>$id)));
                                }

                }

        }
?>

On Sep 29, 12:53 pm, "glenda guo" <[EMAIL PROTECTED]> wrote:
> the default form action parameter is add ,as below, you just need to assign
> it
> echo $form->create('
>
>
>
> > EmployeesAccreditation', array('action' => 'edit'));
> On Sun, Sep 28, 2008 at 7:58 PM, jojiju <[EMAIL PROTECTED]> wrote:
>
> > hi all,
> >    I have  tables employees and accreditations and join table called
> > employees_accreditations. now I want to build the edit form which
> > should populate the information both from employees and
> > accreditations. its driving me crazy please help.
>
> > <div>
>
> >                <fieldset>
> >                        <legend><?php __('Edit Employee'); ?></legend>
> >                                        <?php
> >                                        echo
> > $form->create('EmployeesAccreditation');
> >                                        echo
> > $form->input('id',array('type'=>'hidden'));
> >                                        echo $form->input('card_no');
> >                                        echo
> > $form->input('card_expiry_date',array('type'=>'text'));
> >                                        echo $form->input('first_name');
> >                                        echo $form->input('surname');
> >                                        echo $form->input('date_of_birth');
> >                                        echo
> > $form->input('street_no_and_name');
> >                                        echo $form->input('suburb');
> >                                        echo $form->input('state');
> >                                        echo $form->input('post_code');
> >                                        echo
> > $form->input('telephone_number');
> >                                        echo $form->input('mobile_number');
> >                                        echo
> > $form->input('driving_license_number');
> >                                        echo $form->input('position_title');
> >                                        echo
> > $form->input('employer_company_name');
> >                                        echo
> > $form->input('employer_contact_person_name');
> >                                        echo
> > $form->input('employer_department');
> >                                        echo
> > $form->input('employer_telephone_number');
> >                                        echo
> > $form->input('employer_mobile_number');
> >                                        echo
> > $form->input('employer_fax_number');
> >                                        echo
> > $form->input('employer_email_address');
> >                                        echo
> > $form->input('employer_street_no_and_name');
> >                                        echo
> > $form->input('employer_po_box');
> >                                        echo
> > $form->input('employer_suburb');
> >                                        echo $form->input('employer_state');
> >                                        echo
> > $form->input('employer_post_code');
> >                                        echo
> > $form->input('allergy_description');
> >                                        echo $form->input('sub_category',
> > array('type'=>'select','options'=>array('M'=>'M')));?>
> >                                        <legend><?php __('Edit
> > Accreditations'); ?></legend>
> >                                <?php
> >                                        echo
> > $form->input('Accreditation.accreditation_id',
> > array('type'=>'select','options'=>$accreditationList,'selected' =>
> > $preferenceaccreditation,'label' => __('Accreditation Name', true)));
> >                                        echo
> > $form->input('Accreditation.certification_number');
> >                                        echo $form-
> > >input('Accreditation.issue_date',array('type'=>'text'));
> >                                        echo $form-
> > >input('Accreditation.expiry_date',array('type'=>'text'));
> >                                        echo $form-
> > >input('Accreditation.due_date_assignments',array('type'=>'text'));
> >                                        echo $form->submit('Edit');
> >                                        echo $form->end();
> >                                ?>
> >                </fieldset>
> >        </div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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