我想要一个模态弹出窗体调用另一个页面

时间:2018-03-07 23:24:07

标签: twitter-bootstrap cakephp popup bootstrap-modal cakephp-3.0

即时使用cakephp 3.4.13和下面的bootstrap版本

register.ctp

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
          <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <div class="container">
          <h4>Modal Example with inline form</h4>
          <!-- Trigger the modal with a button -->
          <button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">Open Modal</button>

          <!-- Modal -->
          <div class="modal fade" id="myModal" role="dialog">
            <div class="modal-dialog">

              <!-- Modal content-->
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal">&times;</button>
                  <h4 class="modal-title">Modal Header</h4>
                </div>
                <div class="modal-body">
                  <form class="form-horizontal">

                     <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">Job</label>
                        <div class="col-sm-10">
                            <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">Password</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
                    </div>
                    <div class="col-sm-10 col-sm-offset-2">&nbsp;</div>
                    <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                  <button type="button" class="btn btn-success" data-dismiss="modal">Submit</button>
                    </form>    
                </div>


                  </div>
                </div>
              </div>

            </div>
          </div>

        </div>

上面的代码会弹出,如果我在register.ctp上,因为按钮也在页面中,我的问题是如果我在另一页上,如何使这个表格可用。

我想在login.ctp

上调用它

使用锚标记

<?php echo $this->Html->link('Register',array('controller' =>'users','action' => 'register'),array('data-target'=>'#myModal','data-toggle'=>'modal')); ?>

0 个答案:

没有答案