0
我使用引導模式來彈出一個新的SQLFORM。Web2py SQLFROM:將提交按鈕放入引導按鈕
我想把SQLFORM提交按鈕放到引導按鈕中。所以當引導按鈕被點擊時,表單將被提交。
我不知道如何做到這一點。
這裏是我的代碼:
<script type="text/javascript">
$('#submit').on('click', function (e) {
<?=tag_form.custom.submit?>
})
</script>
<div class="container">
<div id="example" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h5>New Tag</h5>
</div>
<div class="modal-body">
<?=tag_form.custom.begin?>
<strong>Add Tag</strong>
<br/><strong>Tag:</strong><? =tag_form.custom.widget.Tag?><br/>
<br/><strong>Color</strong><? =tag_form.custom.widget.Color?><br/>
<br/><strong>Owner:</strong><? =tag_form.custom.widget.Owner ?><br/>
</div>
<div class="modal-footer">
<a href="#" id="submit" class="btn btn-success">Call to action</a>
<a href="#" class="btn" data-dismiss="modal">Close</a>
<?=tag_form.custom.end?>
</div>
</div>
<p><a data-toggle="modal" href="#example" class="btn btn-primary btn-small">New Tag</a></p>
</div>
<script src="<?=URL('static','js/bootstrap-modal.js')?>"></script>
這一個不工作。
我想出一個可行的辦法:
<div class="container">
<div id="example" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h5>New Tag</h5>
</div>
<div class="modal-body">
<?=tag_form.custom.begin?>
<strong>Add Tag</strong>
<br/><strong>Tag:</strong><? =tag_form.custom.widget.Tag?><br/>
<br/><strong>Color</strong><? =tag_form.custom.widget.Color?><br/>
<br/><strong>Owner:</strong><? =tag_form.custom.widget.Owner ?><br/>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-success"><?=tag_form.custom.submit?></a>
<a href="#" class="btn" data-dismiss="modal">Close</a>
<?=tag_form.custom.end?>
</div>
</div>
<p><a data-toggle="modal" href="#example" class="btn btn-primary btn-small">New Tag</a></p>
</div>
<script src="<?=URL('static','js/bootstrap-modal.js')?>"></script>
然而,按鈕是不漂亮。
我怎麼能用正確的方式做到這一點? 謝謝!