0

我在模态引导窗口中有一个 ajax 表单,但它没有加载表单,而是加载隐藏的输入,而这里缺少表单是我的代码:

<?php  $data = $this->Js->get('#UserSaveProjectsForm')->serializeForm(array('isForm' => true, 'inline' => true));
$this->Js->get('#UserSaveProjectsForm')->event(
      'submit',
      $this->Js->request(
        array('action' => 'save_projects'),
        array(
                'update' => '#commentStatus',
                'data' => $data,
                'async' => true,    
                'dataExpression'=>true,
                'method' => 'POST'
            )
        )
    );?>

<div id="myModal" class="modal hide fade" style="width: 335px; left:56%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-remove icon-black"></i></button>
    <h3 id="myModalLabel">Assign Projects</h3>
</div>
<div class="modal-body" style="width: 300px;">
    <?php echo $this->Form->create('User', array( 'action'=> 'save_projects' ,'class' => 'form-horizontal validationEngine ')); ?>
    <?php  echo $this->Form->input('User.id', array('type' =>'hidden','label' => false)); ?>
    <?php  echo $this->Form->input('Agentgroup', array('options'=> $agent_groups,'multiple'=>true ,'class' =>'multiple','label' => false)); ?>
    <?php echo $this->Form->end(__('Assign')); ?> 
<?php echo $this->Js->writeBuffer(); ?>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>

这是生成的内容:

<div style="width: 300px;" class="modal-body">
    <div style="display:none;"><input type="hidden" value="POST" name="_method"></div>      <input type="hidden" id="UserId" value="30" name="data[User]
4

0 回答 0