javascript - Pop-up does not load correctly. It needs page refresh every time -
there link:
<div > <a href="#" class="newcomment" onclick="bindaddslots()">add details</a> </div> onclick method:
function bindaddslots() { debugger; if (!checkforlogout()) { return false; } clearpopupcontrols(); var dclg; dclg = $("#dvschedulingprofile").dialog( { resizable: false, draggable: true, modal: true, title: "add details", width: "400", height: "460" }); dclg.parent().appendto(jquery("form:first")); } function clearpopupcontrols() { debugger; $("#ddlvisittype").val("select options"); $("#schedulingprofiledetails_id").val("0"); $("#dvschedulingprofile").find("#txtnp").val(""); $("#dvschedulingprofile").find("#txtns").val(""); $("#dvschedulingprofile").find(".lblannualvisittype").hide(); $("#dvschedulingprofile").find(".lblnp").hide(); $("#dvschedulingprofile").find(".lblns").hide(); $("#dvschedulingprofile").find(".lblnpnumeric").hide(); $("#dvschedulingprofile").find(".lblnsnumeric").hide(); $("#schedulingprofiledetails_id").val("0"); } view code:-
<div id="dvschedulingprofile" style="display: none"> @html.validationsummary(true) <table width="100%" height="75%" class="someclass"> <tr id="addvisittype"> <td class="black_label"> @html.hiddenfor(m => m.schedulingprofiledetails.id) @html.label("visit type"):<span class="star">*</span> </td> <td style="font-size: 12px;"> @html.dropdownlist("ddlvisittype", new selectlist((visittypebo.loadall().orderby(x => x.visittypename)), "visittypename", "visittypename"), new { @style = "width:250px;color:black" }) <br/> </td> </tr> <tr> <td height="5"> </td> <td style="color: red; font-size: 12px; display: none;" class="lblannualvisittype" align="left"> @html.label("lblannualvisittype", "visit type required.") </td> </tr> <tr> <td height="5"> </td> </tr> <tr> <td class="black_label"> @html.label("patient slots(np)"):<span class="star">*</span> </td> <td style="font-size: 12px;"> @html.textbox("txtnp", null, new { @style = "width:250px;", maxlength = 11 }) </td> </tr> <tr> <td height="5"> </td> <td style="color: red; font-size: 12px; display: none;" class="lblnp" align="left"> @html.label("lblnp", "np required.") </td> <td style="color: red; font-size: 12px; display: none;" class="lblnpnumeric" align="left"> @html.label("lblnpnumeric", "only numeric values allowed.") </td> </tr> <tr> <td class="black_label"> @html.label("time slots(ns)"):<span class="star">*</span> </td> <td style="font-size: 12px;"> @html.textbox("txtns", null, new { @style = "width:250px;", maxlength = 11 }) </td> </tr> <tr> <td height="5"> </td> <td style="color: red; font-size: 12px; display: none;" class="lblns" align="left"> @html.label("lblns", "ns required.") </td> <td style="color: red; font-size: 12px; display: none;" class="lblnsnumeric" align="left"> @html.label("lblnsnumeric", "only numeric values allowed.") </td> </tr> <tr> <td height="5"> </td> </tr> <tr> <td> </td> <td > <input type="button" value="" class="save_bt" onclick="return savedetails()" style="margin-left:70px;"/> </td> </tr> </table> </div> now problem when page loads , click on link pop-up comes pop-up come out again need refresh code , problem same in browsers. have debug code again , again no error coming , totally confused, plz me overcome issue. in advance.
what need append dialog first element of form? if remove line, should work fine think..
because, first time works since there in 1 element id dvschedulingprofile , after displaying dialog, add same element again first element of form, next time there 2 elements same id, jquery dialog doesn't work since won't find single element given id..
Comments
Post a Comment