我有一个表单,我想在选中复选框时限制下拉列表中的数据
So when the Is Primary checkbox is Checked , There will be no 2 Email address that the Is Primary is Both True !! 这就是我想要防止的
这样当我保存时会出现一个消息窗口并让用户知道他/她选中了相同下拉值的复选框
using (Html.BeginForm("Save", "Worker", FormMethod.Post, new { id = "contactForm" }))
{
<input type="hidden" id="workerId" name="workerId" value="@workerId" />
<p>
<label for="ddlContactType">
Contact Type</label>
<span>
@Html.DropDownList("ddlContactType", new SelectList(ViewBag.ContactTypeList, "ID", "Display_Value", workerContactType), "[Please Select]",
new Dictionary<string, object>
{
{"class","validate[required] inputLong"}
})
</span>
</p>
<p>
<label for="txtContactValue">
Contact Value</label>
<span>
<input type="text" id="txtContactValue" name="txtContactValue" class="validate[required] inputLong" value="" />
<input type="checkbox" name="chkWorkerIsPrimary" id="chkWorkerIsPrimary" value="true"
checked="checked" />
<label>
Is Primary?</label>
</span>
</p>
<p>
<span>
<input type="submit" id="btnAdd" class="styledButton" value="Add" />
</span>
</p>
}
</div>
我需要用 Javascript 或 Jquery 编写的验证,但我不知道如何开始:(
谢谢