javascript - validation on a required field -
working validation example: http://www.w3schools.com/aspnet/showaspx.asp?filename=demo_validationsum
using asp.net display error message 'you must come in value in next fields:' include field name wrong, when info incorrectly entered.
so far user cant go on until right info entered , reddish * appears beside column. add together error message.
<div id="floater_editdata_panel_popup" title="feature information" class="floaterdiv"> select feature view/edit feature information. <p> </p> <asp:updatepanel runat="server" id="updatepaneldetails1" updatemode="conditional" childrenastriggers="false"> <contenttemplate> <asp:placeholder id="placeholder1" runat="server" > </asp:placeholder> <br /> <br /> <div id="editdatapanelmessageoutput" style="color:red;"> <asp:validationsummary id="validationsummary1" headertext="you must come in value in next fields:" displaymode="bulletlist" enableclientscript="true" runat="server"/> </div> <div id="featuremeasureoutput"></div> <br /> <br /> <div class="buttonwrap"> <div id="span2" class="actionbtns" style="display: inline-block;" > <asp:button runat="server" id="updatebutton" value="save" text="save" onclientclick="validateeditdata();" causesvalidation="true" validationgroup="g_currentselectedlayername" /> </div> </div> </contenttemplate> </asp:updatepanel> </div> function validateeditdata() { if (page_clientvalidate(g_currentselectedlayername)) { //alert('it valid'); updatefeature(); homecoming true; } else { //alert('data not valid'); homecoming false; } }
shouldnt validation summary tag apply entire page?
how about:
<asp:validationsummary id="validationsummary1" headertext="you must come in value in next fields:" displaymode="bulletlist" enableclientscript="true" validationgroup="g_currentselectedlayername" runat="server"/> <asp:textbox id="txtfirstname" runat="server"></asp:textbox> <asp:requiredfieldvalidator runat="server" display="dynamic" controltovalidate="txtfirstname" errormessage="first name required" validationgroup="g_currentselectedlayername"></asp:requiredfieldvalidator> <asp:button runat="server" text="submit" validationgroup="g_currentselectedlayername" />
and add together appsetting web.config:
<appsettings> <add key="validationsettings:unobtrusivevalidationmode" value="none" /> </appsettings>
javascript html asp.net requiredfieldvalidator
No comments:
Post a Comment