If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

JavaScript code flow will wizz down to the last status check while the 2nd one is still processing. It does not wait for each step to complete. Therfore "test 2" does not influence the returned "status" value. I believe this is due to the asynchronous nature of "test 2"? After researching the problem area for many days in Google Land, I think I'm fairly close to a solution. The code fails at the point where function CheckServerSide attempts to return its value to myVar, and hence to the web page call: ClientValidationFunction="MyValidator". Any suggestions on how to do this? Thanks in advance, Pete.

Hi, on reading through my original question, the setTimeout part does not make sense. It's the result of many modifications on trying to resolve the problem. Sorry for that! So basically what I'm trying to ask is "how can I get "status" returned that is based on all 3 tests as shown in the following model?

Well judging by there being no response on this one, I realise now that the JavaScript Client-Side approach would be going nowhere. So I've decided to do a workaround for the asynchronous JavaScript problem, and I've posted my own solution to help anyone else who may be having the same problems that I faced.

This method now works perfectly, after many days of hacking around with the code!

<script type="text/javascript" language="javascript">

function MyValidator(sender, args) {
/* This workaround method overcomes the asynchronous problems
of JavaScript not waiting on conditional statement outcomes.
The aim is to push all conditional checks and outcomes to
Server-side where no asynchronous problems occur. Then return
a string message back to Client-Side indicating which conditional
check failed. Appropriate Client-Side error messages can then be
generated, and returned to the ListView input textbox in my example.

To call Server-Side code from JavaScript, you can use ASP.NET
AJAX Extensions. Then use "PageMethods" to call Server-Side
functions using JavaScript