ok so i dont know how to make this work.
i need to save multiple records at once with HABTM rel with it..
model:
OfferedSubject
Course
CourseOfferedSubject
means that an offered_subject may have many course with it and vice
versa..
i read the manual that says to save multiple records using saveAll()
you need to add a numerical index on it..
this is what i did so far.
<?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
),
'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 __('Section');?></th>
<th><?php echo __('Description');?></th>
<th><?php echo __('Lab Units');?></th>
<th><?php echo __('Lecture Units');?></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;
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 $form->input($i.'.section'); ?>
</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($i.'.days'); ?>
</td>
<td>
<?php echo $form->input($i.'.times'); ?>
</td>
<td>
<?php echo $form->input($i.'.room'); ?>
</td>
<td>
<?php echo $form->input($i.'.limits'); ?>
</td>
<td>
<?php
echo $form->input($i.'.gender_flag',array(
'type'=>'select',
'options'=>
array(
'M'=>'M',
'F'=>'F'
),
'empty'=>'Choose One'
)
);
?>
</td>
<td>
<?php echo $form->input($i.'.college_id');?>
</td>
<td>
<?php echo $form->input('Course'); ?>
</td>
</tr>
<?php } ?>
</table>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
now my problem is how can i add numerical index to my $form->input
('Course'); ?
when i leave it that way,whenever i submit my form, only one record is
saved which is the last entry.
i read about using loop in saving multiple records, but what about
saveAll()?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---