Polling function that halts other execution
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Polling function that halts other execution

From: <alacrite@gmail.com>
Date: Tue Jan 24 2006 - 17:58:32 CET

I am doing some form validation with a mix of javascript and server
side methods called via AJAX. When the submit button is pressed the
onclick calls the validation function that will return true if
everything checks out ok and false if not. The validation function is
setup like so:

function validateForm()
{
  returnValue = true;
  ajaxFunctionToCheckDate(); //the way it works, inside the function
is the only place to set
  ajaxFunctionToCheckEmail(); // the returnValue to false if it does
not checkout
  //the ajaxFunctions return to another javascript function
   ...
  //right here I would like to do some polling to make sure all the
ajax functions have returned.
  //I have tried using a settimout recursive function but that of
course does not work.
  // because it allows the function to return

  return returnValue;
}

anyway to make sure a function has returned before allowing the form to
submit?
Thanks,
Jake
Received on Tue Feb 7 21:21:05 2006