views:

574

answers:

3

I have a basic CRUD form that uses PageMethods to update the user details, however the Validators don't fire off, I think I need to manually initialize the validators and check whether the validation has passed in my javascript save method. Any ideas on how to do this?

A: 

what are you using for development? VS 2008 supposedly has better JS debugging, haven't tried it yet.

For Ajax you can use the Sys.Debug obj

Sara Chipps
A: 

If you use Firefox, you can use the FireBug plugin. It has great javascript debugging support.

Dale Ragan
+1  A: 

Ok so I finally solved this: You need to call Page_ClientValidate() in your Save javascript method and If it returns true continue with the save, the Page_ClientValidate() initiates the client side validators, See code below:

 function Save()
 {
  var clientValidationPassed =Page_ClientValidate();
  if(clientValidationPassed)
  {
   //Save Data
   PageMethods.SaveUser(UserName,Role,SaveCustomerRequestComplete, RequestError);
   $find('editPopupExtender').hide();
  }
  else
  {
   //Do Nothing as CLient Validation messages are now displayed
  }
  return false;
 }
Nicholas