I am developing a form where I need to validate some of the information the user enters. I would like to validate this information AS THE USER moves through the form.
So, i was thinking that I could call SUBS and/or FUNCTIONS using the OnBlur Event on the form fields I need to validate.
Is this even possible?
You will see in the code example below that i am using an asp:image button that fires the validation routine using the onclick event. I would like to apply that same logic the form's input "OnBlur" event.
Thank you in advance for your reply.
<label for="txbCustomerCode">Customer Code: </label>
<input id="txbCustomerCode" type="text" size="15" name="txbCustomerCode" runat="server" tabindex="3" title="Your Four Season's account number. You can find this number on an invoice, or contact your Sales Representative." />
<asp:ImageButton CssClass="validation" ImageUrl="Images/Warning-20.png" runat="server" OnClick="subCheckCustomerCode" ID="imgCustomerCodeValidate" />
<p class="labelinfo">Your Four Season's account number. You can find this number on an invoice, or contact your Sales Representative.</p>
<br class="clear" />
Protected Sub subCheckCustomerCode(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgCustomerCodeValidate.Click
Dim strCustomerCode As String = "123456"
Dim strCustomerCodeText As String = txbCustomerCode.Value
If strCustomerCodeText = strCustomerCode Then
imgCustomerCodeValidate.Attributes("src") = "Images/Checkmark-20.png"
imgCustomerCodeValidate.Attributes("src") = "Images/Error-20.png"