J
Jay Douglas
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
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