javascript - custom validator not working in bootsrap -


i have text field , if empty want throw error. using javascript function , custom validator this.

<div class="table-container" style="border: none">     <div class="table-row">         <div class="table-col">             <div class="label">                 abstract title (*)             </div>             <div class="smallnormal">                 please enter abstract title appear on poster            </div>        </div>    </div>    <div class="table-row">        <div class="table-col">            <asp:textbox id="txttitle" runat="server" maxlength="500" cssclass="textentry" width="800px"></asp:textbox>            <asp:customvalidator id="customvalidator6" clientvalidationfunction = "checktitle" runat="server" errormessage="title required" cssclass="failurenotification">[ * ]</asp:customvalidator>        </div>    </div>  <script>     function checktitle(sender, args) {         var isvalid = false;         var bodywithouthtmltag = document.getelementbyid('<%=txttitle.clientid%>').value;         var wordcountinbody = wordcount(bodywithouthtmltag);          if ((wordcountinbody - 1) == 0) {             var singlewordinbody = bodywithouthtmltag;             singlewordinbody = singlewordinbody.replace(/(^\s*)|(\s*$)/gi, "");             var lengthofword = singlewordinbody.length;              if (lengthofword >= 1) {                 args.isvalid = true;             }             else {                 alert("arg false");                 args.isvalid = false;             }         }                  } </script> 

it working fine when not using bootstrap properties, when applied bootstrap properties stopped working.

after bootstrap:

<div class="panel-body">     <div class="form-group form-group-md">         <div class="form-horizontal">             <div class="row">                 <div class="col-sm-12">                     <label>abstract title (*)</label>                     <asp:customvalidator id="customvalidator6" clientvalidationfunction = "checktitle"                                          runat="server" errormessage="title required" cssclass="failurenotification">[ * ]</asp:customvalidator>                     <small>please enter abstract title appear on poster</small>                 </div>                 <div class="col-sm-10">                     <asp:textbox id="txttitle" runat="server" maxlength="500" cssclass="form-control" width=""></asp:textbox>                 </div>             </div>         </div>     </div> 


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -