现在,当我没有单击任何复选框时,显示错误请选择一个选项,但是当我单击确定按钮时,它将继续其他弹出表单。我想保留在同一弹出页面上。我的弹出表单代码:
function valthisform()
{
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
var checkedOne = Array.prototype.slice.call(checkboxes).some(x => x.checked);
if (checkedOne == true)
{
}
else
{
alert ("Kindly select at least one option !")
form.reload();
}
}
<form name="myform">
<div id="outer-container">
<label class="ac-service">
Choose Your Service
</label>
<br>
<hr/>
<label id="l-1"><input type="checkbox" id="c1" name="checkboxes">AC Not Cooling Properly/Repair</label>
<ul class="u">
<li>Complete Diagnosis</li>
<li>Final Charges Based on Inspection</li>
</ul>
<hr/>
<label id="l-1"><input type="checkbox" id="c1" name="checkboxes">Wet Servicing</label>
<ul class="u">
<li>Deep Cleaning the AC for fresh air</li>
<li>Filter, coils etc. cleaned with water</li>
<li>Save upto 20% on your summer electricity bill with regular servicing </li>
</ul>
<hr/>
<label id="l-1"><input type="checkbox" id="c1" name="checkboxes">Installation</label>
<ul class="u">
<li>Parts & wall modification charges extra</li>
</ul>
<hr/>
<label id="l-1"><input type="checkbox" id="c1" name="checkboxes">Uninstallation</label>
<hr/>
<label id="l-1"><input type="checkbox" id="c1" name="checkboxes">Gas Charging</label>
<ul class="u">
<li>Complete vacuuming and gas filing</li>
<li>Partial gas refilling/top-up is not recommended</li>
<li>Minor leakages will be fixed</li>
<li>Leakage check with Nitrogen is not included</li>
</ul>
<hr/>
<input type="button" id="fixed-button" onclick="return valthisform(this.form);" value="Next" class="popmake-391">
</div>
</form>
我正在使用popup maker在wordpress中创建弹出窗口,并与form 7联系以创建表单。
谢谢!