1
我有一個表格,我希望在複選框被選中防止多主當複選框被選中
從我刪除Downlist限制數據因此,當被主複選框被選中,將不會有2電子郵件地址,是主要是兩個真!這就是我想要防止
這樣,當我保存那裏有一個信息窗口將會出現,讓用戶知道他/她檢查爲同一下拉選框價值
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的審定,但我不知道如何下手:(
感謝
您可以在複選框的單擊事件中處理該事件。答案中的代碼 – Krishna