jquery - How to validate Hidden field -


i using datatable(bind using json) listing enrolled currencies. here how call class data database:

<script type="text/javascript">      function cancelbyredirect() {         window.location = "pendingtransaction.aspx";     }      function btnselect_click(id) {         jquery('#<%= vid.clientid %>').val(id);     }       jquery(document).ready(function ($) {          jquery("#dialog").dialog({ autoopen: false });          jquery("#indicator").hide();          jquery('#tblvirtualaccounts').datatable({             bprocessing: true,             bserverside: true,             bfilter: false,             sajaxsource: '<%= resolveurl("~/merchant/virtualaccount/tablehelpercheque.aspx")%>',             olanguage: {                 "szerorecords": "no records found",                 "sprocessing": 'fetching records..<img height="32px" width="32px" src="<%= resolveurl("/images/velocity/wait-white.gif") %>">'             },             aocolumndefs: [{                 stitle: "", bsortable: false, fnrender: function (oobj) {                     var retbuttons = '<button type="button" class="btnselect" id="btnselect" name="btnselect" onclick="btnselect_click(' + oobj.adata[0] + ')">select</button>';                      return retbuttons;                 },                 sdefaultcontent: '', atargets: [0]             },                 { stitle: "account name", atargets: [1], sdefaultcontent: '' },                 { bvisible: false, atargets: [2], sdefaultcontent: '' },                 { stitle: "currency", atargets: [3], sdefaultcontent: '' },                 { bvisible: false, atargets: [4], sdefaultcontent: ''}],              fndrawcallback: function () {                 $('.btnselect').click(function () {                     $(this).parent().parent().parent().find("tr").css({ "background": "#ffffff" });                     $(this).parent("td").parent("tr").css({ "background": "#ebebeb" });                 });             } //end fndrawcallback          }); //end datatable                 });   //end document.ready  </script> 

here html:

<asp:hiddenfield id="vid" runat="server" value="0" />         <table id="tblvirtualaccounts" cellpadding="0" cellspacing="0" border="0" class="stdtable">                                 <thead>             </thead>             <tbody>             </tbody>             <tfoot>             </tfoot>         </table>         <p class="stdformbutton">        <asp:button cssclass="submit radius2" text="submit" runat="server" id="btnsubmit" commandname="finish" oncommand="btnapprovetransaction_oncommand" />        <button type="button" id="btncancel" onclick="cancelbyredirect()" class="radius2" runat="server">cancel</button>        </p> 

now, question is: how able validate hidden field. when vid.value = "0" errormsg be: please choose account. , when vid.value != "0" transaction saved.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -