我有一個表單裏面的jQuery UI模式對話框,當我點擊提交按鈕沒有任何反應。有沒有辦法在jQuery模式對話框中提交表單,而不必在JavaScript中編碼按鈕?你可以提交一個jQuery的模式對話框內的表格
這是我的代碼片段;
<script>
// increase the default animation speed to exaggerate the effect
$(function() {
$("#dialog").dialog({
autoOpen: false,
draggable: false,
resizable: false,
modal: true,
});
$("#opener").click(function() {
$("#dialog").dialog("open");
return false;
});
});
function SetValues()
{
var s = 'X=' + window.event.clientX + ' Y=' + window.event.clientY ;
document.getElementById('divCoord').innerText = s;
}
</script>
<div id="dialog" title="new task">
<form method="post" action="/projects/{{ project.slug }}/">
<div class="form-row">
<label class="required" for="title">task type</label>
<select name="type">
{% for TaskType in project.tasktype_set.all %}
<option value="{{ TaskType.name }}">{{ TaskType.name }}</option>
{% endfor %}
</select>
</div>
<div id="buttons">
<input type="submit" value="create"/>
</div>
</form>
</div>
<button id="opener">new task</button>
如果我刪除「模態:真」,使對話框非模態,它將提交。
相關http://stackoverflow.com/questions/4743751/jquery-modal-dialog-box-isnt-submitting-my-form – 2011-04-03 06:52:50
哈伊姆,我有看到這篇文章 - 略有不同的情況,因爲在提供的URL提供的jQuery對話框只是確認提交操作,而我的表單是模式對話框的一部分。 我也嘗試過這個,但沒有成功(它也不會提交我的表單)。\ – Jamie 2011-04-03 07:41:16