Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Asp.net, c#, custom validator, AJAX, client validate script, wait for server response

Reply
Thread Tools

Asp.net, c#, custom validator, AJAX, client validate script, wait for server response

 
 
Jay Douglas
Guest
Posts: n/a
 
      02-27-2007
Hello all,

I'm in need of a custom validator that:

1). Runs server side code using ajax through a client validate function
2). Client validate function does not set args.IsValid until the server
responds
3). Any submit actions (via link button) do not take place until all client
validate functions run.

Pseudo client validate function (javascript):

I would like a method that works like:
function myClientValidate(sender, args)
{
// here's where i'd like the args to be sent
args.IsValid = WebForm_DoCallback(.....).;
}

Unfortunately, the CallBack fires a different event to deal with the
response, so I'm forced to do something like:

var isControlValid = false; // dynamically set on page load

function myClientValidate(sender, args)
{
return isControlValid;
}

function executeValidatorCallback()
{
WebForm_DoCallback(.....)
}

function updateCallbackResults(returnValue, context)
{
isControlValid = returnValue; // basically context just returns true or
false
}

To keep isControlValid I'm running executeValidatorCallback() on certain
page events and on a timed interval. This seems really messy to me.

So my question is:
How do I send a request to the server using javascript and wait for the
server responds before the javascript continues.

I'm at a loss, any advice would be great.

Thanks,
Jay


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
validate Date input using Custom Validator Grey ASP .Net 3 10-09-2012 06:11 AM
Asp.net, c#, custom validator, AJAX, client validate script, wait for server response Jay Douglas ASP .Net 0 02-27-2007 01:07 AM
Server to server = Server client to server? - Java 2 07-29-2005 10:46 PM
tool to validate xml file against custom XML Schema file Leona XML 9 11-01-2004 09:51 AM
How to make "fork/wait" to WAIT longer? Huey C Programming 1 03-01-2004 02:01 PM



Advertisments