gpt4 book ai didi

javascript - 我想提交一个表单,但在提交之前我想从模态表单中获取一个值

转载 作者:行者123 更新时间:2023-11-28 05:44:09 24 4
gpt4 key购买 nike

我想提交一个表单,但在提交之前我想从模态表单中获取一个值。实际要求是,我必须使用复选框选择多行,然后我想更新数据库值。

// <!-- 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>

最佳答案

尝试这样的事情:

Change the input[type=submit] to input[type=button] 

现在点击按钮:

$('button').click(function(){
var value = $('#id').val();

// submit the form
$('#fomrid').submit();
});

关于javascript - 我想提交一个表单,但在提交之前我想从模态表单中获取一个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38681310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com