【发布时间】:2013-07-14 07:29:57
【问题描述】:
我想知道如何使用 JavaScript 来处理这个问题。当我选中 IsPrimary 的 ccheckbox 时,我会将该下拉数据限制为唯一值,它是该下拉值的唯一主要值。
因此,Contact Type 中的每个值都必须只有一个主要的
这是我的 Cshtml
<p>
<label for="ddlContactType">
Contact Type</label>
<span>
@Html.DropDownList("ddlContactType", new SelectList(ViewBag.ContactTypeList, "ID", "Display_Value", ContactType), "[Please Select]",
new Dictionary<string, object>
{
{"class"}
})
</span>
</p>
<p>
<label for="txtContactValue">
Contact Value</label>
<span>
<input type="text" id="txtContactValue" name="txtContactValue" inputLong" value="" />
<input type="checkbox" name="chkIsPrimary" id="chkIsPrimary" value="true" checked="checked" />
<label>
Is Primary?</label>
</span>
</p>
我只想验证我将如何限制联系人类型值。我只需要 1 IsPrimary 每个下拉列表数据。例如,我添加了一个电子邮件地址并选中了 IsPrimary 复选框,然后当我再次选择电子邮件地址并选中 IsPrimary 复选框时,它将保存。有一个通知,电子邮件地址中只有一个 IsPrimary。
谢谢:D
【问题讨论】:
-
您能详细说明一下吗?我听不懂你在问什么?
标签: javascript asp.net asp.net-mvc drop-down-menu checkbox