jquery - Invoking CustomValidator validation from JavaScript -


i have following setup, custom validating textbox. works fine long manually typing in textbox , changing text , focusing out of textbox.

<asp:textbox id="tbpcity" runat="server"/>      <asp:customvalidator id="cvpermanentcity" runat="server" controltovalidate="tbpcity"   errormessage="customvalidator" onservervalidate="field_servervalidate"   setfocusonerror="true" display="dynamic" tooltip="permanentcity" />  <ajaxtoolkitwcsfextensions:serversidevalidationextender id="permanentcityserversidevalidationextender" runat="server" targetcontrolid="cvpermanentcity" /> 

when try invoke validation change event javascript (using jquery 1.4.2)

function copycity() { $('#<%= tbpcity.clientid%>').value = "some city"; $('#<%= tbpcity.clientid%>').trigger("change"); } 

the custom validation not being invoked.

how can inovke customvalidator validation?

note: have verified works on firefox not on ie. please let me know how fire change event in ie.

i have found answer posted similar question on stackoverflow.

var tbpermanentaddresscity = document.getelementbyid('<%= tbpcity.clientid%>'); if (tbpermanentaddresscity.fireevent) {     tbpermanentaddresscity.fireevent("onchange"); } else {     $('#<%= tbpcity.clientid%>').change(); } 

once onchange event fired, customvalidator picks , validates textbox.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -