c# - Prevent Multiple Primary When the Checkbox is Checked -
i have form want limit data drop downlist when checkbox checked
so when primary checkbox checked , there no 2 email address primary both true !! want prevent

so when save theres message window appear , let user know he/she checked checkbox same drop down value
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> primary?</label> </span> </p> <p> <span> <input type="submit" id="btnadd" class="styledbutton" value="add" /> </span> </p> } </div> i need validation written in javascript or jquery dont know how start :(
thanks
this begin.
$('#chkworkerisprimary :checkbox').click(function() { var $this = $(this); if ($this.is(':checked')) { // } else { //do else } });
Comments
Post a Comment