Yii Framework Forum: Ajax call on a form with two models only passing one model - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ajax call on a form with two models only passing one model Rate Topic: -----

#1 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 171
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 28 June 2012 - 09:18 PM

I have created a form that includes two models (Job and Artwork) which works perfectly fine. I have added a radioButtonList to Artwork that onchange will make an Ajax request. However when one of these values are changed the Ajax call will only send (via GET) the Job fields and no Artwork fields.

<div class="row">
    <?php echo $form->labelEx($artwork,'printingType'); ?>
    <?php echo $form->radioButtonList($artwork,'printingType', $artwork->getPrintingTypes(),
                   array('onchange'=>CHTML::ajax(
                        array('type'=>'GET', 'url'=>array(
                              'job/loadArtworkForm'), 'update'=>'#data')))
               ); ?>
    <?php echo $form->error($artwork,'printingType'); ?>
</div>


Has anyone experienced this before? How can I have the Ajax call pass values for both models?
0

#2 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 171
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 28 June 2012 - 10:30 PM

I worked it out.

I was trying to gather the variable with $_GET['Job']['printingType'] rather that $_GET['Artwork']['printingType'].

Silly mistake.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users