1
我想提交表單,但在提交之前我想從模態形式取值。實際要求是,我必須使用複選框選擇多行,然後我想更新數據庫值。我想提交一個表單,但在提交之前我想從模態形式取值
// <!-- JAVASCRIPT ON MODAL FORM SUBMIT -->
function changeLeadStage() {
if (confirm("Are you sure want to UPDATE lead ?")) {
document.frmUser.action = './changeleads.php';
document.frmUser.submit();
}
}
<!-- BUTTON PRESSED AFTER SELECTING ROWS -->
<input type="button" class="btn btn-sm btn-success warning_1" value="changeLeadStage" onClick="action/changeLeadStage();" />
<!-- MODAL FORM -->
for updating the database after selecting rows i opened a model form and want to take a value from dropdown of form. and after submit i want to change database value.
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Subscribe our Newsletter</h4>
</div>
<div class="modal-body">
<form name="frmUser" action="" method="POST">
<select name="leadStageName" type="text" style="padding:5px; border-radius:3px;" required />
<option value="" selected>Select LeadStage</option>
<option value="LeadStage1">LeadStage1</option>
<option value="LeadStage2">LeadStage2</option>
<option value="LeadStage3">LeadStage3</option>
<option value="LeadStage4">LeadStage4</option>
<option value="LeadStage5">LeadStage5</option>
</select>
<br>
<br>
<br>
<input type="submit" name="changeLeadStage" class="btn btn-sm btn-success warning_1" onClick="action/changeLeadStage();" />
</form>
</div>
</div>
</div>
</div>
歡迎SO!你可以嘗試添加一個'button'而不是'input [type = submit]',點擊這個按鈕,驗證表單,顯示模式並獲取值。然後點擊模式上的按鈕,提交表格。 – Rajesh
如果您想使用複選框而不是複選框,上面的html會顯示選擇標籤,而不是複選框。 –
另外,將'onClick =「action/changeLeadStage()」'改爲'onClick =「changeLeadStage();''' –