sir Webbedit heres my rel:
Subject hasMany OfferedSubject
OfferedSubject HABTM Course

heres my controller without the save:

function offeredSubjectAdd($subjectId = null, $lastSec = null, $numSec
= null){
                        debug($this->data);
                        if(isset($this->data['numSec'])){
                                
$this->Session->write('OfferedSubject.numSec',$this->data
['numSec']);
                        }

                        $courses = $this->College->listCourses();
                        $subjects = $this->Subject->find('first',array(
                                                                                
                                'conditions' => array(
                                                                                
                                        'Subject.id =' => $subjectId
                                                                                
                                        )
                                                                                
                                )
                                                                                
                        );
                        $colleges = $this->Campus->listColleges();
                        
$this->set('numSec',$this->Session->read('OfferedSubject.numSec'));
                        $this->set(compact('courses',  'subjects', 
'colleges','subjectId',
'lastSec'));
                        $this->layout = 'ajax';
                }

heres my view:

<?php if (isset($url)) echo $javascript->codeBlock('window.location =
"'.$url.'"'); ?>
<?php $session->flash(); ?>
<div class="offeredSubjects form">

<?php

echo $ajax->form(array(
                                        'type' => 'post',
                                        'options'=>array(
                                                'url'=>array(
                                                        
'controller'=>$this->params['controller'],
                                                        
'action'=>'offeredSubjectAdd'.'/'.$subjectId.'/'.$lastSec.'/'.
$numSec
                                                ),
                                                'model'=>'OfferedSubject',
                                                'update'=>'results'
                                        )
                                ));

                                         ?>



<fieldset>
                <legend><?php __('Add OfferedSubject');?></legend>
<table cellpadding="0" cellspacing="0">
<tr>
        <th><?php echo __('Subject Id');?></th>
        <th><?php echo __('Subject');?></th>
        <th><?php echo __('Description');?></th>
        <th><?php echo __('Lab Units');?></th>
        <th><?php echo __('Lecture Units');?></th>
        <th><?php echo __('Section');?></th>
        <th><?php echo __('Days');?></th>
        <th><?php echo __('Times');?></th>
        <th><?php echo __('Room');?></th>
        <th><?php echo __('Limit');?></th>
        <th><?php echo __('Exclusive Gender');?></th>
        <th><?php echo __('College');?></th>
        <th><?php echo __('Exclusive Course');?></th>
</tr>
<?php
$i = 0;
$j = 0;
while ($i<$numSec){
        $class = null;
        if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
        }
?>
        <tr <?php echo $class;?>>
                <td>
                        <?php echo $subjects['Subject']['id']; ?>
                </td>
                <td>
                        <?php echo $subjects['Subject']['code']; ?>
                </td>

                <td>
                        <?php echo $subjects['Subject']['name']; ?>
                </td>
                <td>
                        <?php echo $subjects['Subject']['lab_units']; ?>
                </td>
                <td>
                        <?php echo $subjects['Subject']['lecture_units']; ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.section'); ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.days'); ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.times'); ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.room'); ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.limits'); ?>
                </td>
                <td>
                        <?php
                                echo $form->input($j.'.gender_flag',array(
                                                                
'type'=>'select',
                                                                'options'=>
                                                                        array(
                                                                                
'M'=>'M',
                                                                                
'F'=>'F'
                                                                        ),
                                                                
'empty'=>'Choose One'
                                                )

                                        );
                        ?>
                </td>
                <td>
                        <?php echo $form->input($j.'.college_id');?>
                </td>
                <td>
                        <?php echo $form->input($j.'.OfferedSubject.Course'); ?>
                </td>
        </tr>
<?php $j++;} ?>
</table>


        </fieldset>
<?php echo $form->end('Submit');?>
</div>

<?//pr( get_defined_constants() );?>

i followed what you suggest but just in the
<?php echo $form->input($j.'.OfferedSubject.Course'); ?> part but
instead of having a multiselect it changes to a normal select option
the cookbook said that:
"A more likely scenario with a HABTM relationship would include a
<select> set to allow multiple selections. For example, a Recipe can
have multiple Tags assigned to it. In this case, the data is pulled
out of the model the same way, but the form input is declared slightly
different. The tag name is defined using the ModelName convention."
thats why i only used
<?php echo $form->input('Course'); ?> before....

and now im still stuck with the resulting array...
its been days now,still no luck; (

@brian, i did not receive your message.sorry
@webbedit, thanx for your help, i want to hear more from you sir..
thanx
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to