Welcome Guest ( Log In | Register )

Bump Topic Topic Closed RSS Feed

Outline · [ Standard ] · Linear+

.NET Fire custom validator onblur() in textbox, VB.NET

views
     
TSsteven1379
post Aug 26 2011, 04:02 PM, updated 15y ago

Getting Started
**
Junior Member
234 posts

Joined: Nov 2006
hi all....


i want whenever a txtEmail lost focus ... it will call server side event eg: CheckEmailExists instead of waiting a [submit] button hitted to fire the checking.


Anyone can help ? please dont ask me to client side validation as i need to query database to get result.
TSsteven1379
post Aug 26 2011, 05:47 PM

Getting Started
**
Junior Member
234 posts

Joined: Nov 2006
QUOTE(jonchai @ Aug 26 2011, 05:06 PM)
Use ontextchanged event.
*
beside this method ? is there any way to fire the custom validator ?
TSsteven1379
post Aug 28 2011, 06:58 PM

Getting Started
**
Junior Member
234 posts

Joined: Nov 2006
eueu ... thanks for reply... but something i dont understand over here ...

<asp:CustomValidator ID="CustomValidator1" runat="server"
Display="Dynamic" ControlToValidate="txtLoginId"
ErrorMessage="Login ID exists" ClientValidationFunction="CHECK"></asp:CustomValidator>


function CHECK(source, args) {
//alert($get('<%= txtLoginId.ClientID %>').value);
PageMethods.GetContactName($get('<%= txtLoginId.ClientID %>').value, onSucceeded, onFailed);
}
function onSucceeded(msg, userContext, methodName, onFailed) {
var gg = msg;
if (gg != 1) {

args.IsValid = false;
}
}
function onFailed(error, userContext, methodName) {
alert("An error occurred");
}


vb.net code
Public Shared Function GetContactName(ByVal s As String) As Integer
Return Convert.ToInt16(s)
End Function


the problem is args.isValid can only be used inside CHECK function... because it receive args parameter from the custom validator...

i want to fire the args.IsValid in onSucceeded ...
TSsteven1379
post Aug 29 2011, 03:34 PM

Getting Started
**
Junior Member
234 posts

Joined: Nov 2006
brother, too hard for me to understand this ... i couldnt even get compiled successfully


Added on August 29, 2011, 7:05 pmbrother i am trying to use the web service method ...

CODE
function CHECK(source, args) {
           
           //alert($get('<%= txtLoginId.ClientID %>').value);
           //PageMethods.GetContactName($get('<%= txtLoginId.ClientID %>').value, onSucceeded, onFailed);
           dummyWebservice.HelloWorld();          
           
       }




but it give me dummyWebservice undefined when onblur on textbox ...

This post has been edited by steven1379: Aug 29 2011, 07:05 PM

Topic ClosedOptions
 

Change to:
| Lo-Fi Version
0.0191sec    1.09    6 queries    GZIP Disabled
Time is now: 18th December 2025 - 05:01 PM