如何从Bootstrap对话框中提交按钮值?

时间:2015-01-30 14:37:44

标签: javascript php twitter-bootstrap

我希望在提交后获得按钮的值(这里是“删除”)。如下所示

$buttonValue = $_REQUEST['deletebutton'];
            if($buttonValue == 'delete') 
            {....}

但是我认为Bootstrap对话框没有提交扩展我的按钮的表单。提交后有没有办法获得这个值?

<form>
<!-- Button trigger modal -->
<button id="deleteButtonId" type="button" name="deletebutton" value="delete" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
  </div>
  <div class="modal-body">
    ...
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <button type="submit" class="btn btn-primary">Submit</button>
  </div>
  </div>
 </div>
</div>
</form>

0 个答案:

没有答案