再次显示已在PHP中打开以进行验证的模式对话框

时间:2015-08-26 06:04:26

标签: javascript php jquery ajax validation

我有一个用于插入,更新和删除的PHP页面,其中弹出的编辑内容如下所示

enter image description here

在根据id显示的图像背景中的表格中单击编辑按钮时,弹出按jquery显示如下:

 $('.edit').live('click',function(){
    var id=$(this).attr('data-id');
    params={};
    params.id=id;
    params.action="editClient";
    $('#popupbox').load('chapter_manager.php', params,function(){
        $('#block').show();
        $('#popupbox').show();
           $(document).ajaxComplete(function(){
    $("#wait").css("display", "none");
});
    })

我需要验证两个输入框。使用jquery它工作正常。

我需要执行服务器端验证。

问题是在点击按钮后页面会被重新编码,因此在服务器端验证后不再显示弹出窗口。

我尝试了ajax但没有工作。不知道怎样才能再次显示弹出窗口?

此外,我想知道在已经在jquery中进行验证时是否需要执行PHP服务器端验证?

我在模式弹出窗口中使用了一个页面模板,其中提交和提交按钮如下所示,这与后台显示的页面不同。

 <form name ="client" id="client" method="POST" action="chapter_manager.php"><div style="display: block; position:relative;" class="modal">
    <div class="modal-dialog" style="width:100%; margin:0px 0px 0px 0px;">
      <div class="modal-content">
        <div class="modal-header">
          <button id="close_form" type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
          <h4 class="modal-title"> <?php echo $view->label ;?> </h4>
        </div>
        <div class="modal-body">
          <table>
            <tr><td><input type="hidden" name="id" id="id" value="<?php print $view->client->getChapter_ID() ?>"> <label>Name:</label>
                <span style="color:#c30;">*</span>
                <?php /*?><span class="error">* <?php echo $nameErr;?></span><?php */?>
                <span class="error"> <?php echo $nameErr;?></span> </td>
              <td><input type="text" class="form-control" name="name" id="name" value = "<?php print $view->client->getChapter_Name() ?>">
              </td>
            </tr>
            <tr>
              <td><br/>
              </td>
              <td></td>
            </tr>
            <tr>
              <td><label>Description:</label>
                <span style="color:#c30;">*</span> </td>
              <td><input type="text" class="form-control" name="description" id="description" value = "<?php print $view->client->getChapter_Description() ?>">
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <input id="cancel" class="btn btn-default pull-left" type="button" value ="Cancel" />
        <input id="submit" class="btn btn-primary "  type="submit" name="submit" value ="Save Changes" />
      </div>
    </div>
  </div>
  </div>
  </div>
</form>

0 个答案:

没有答案