callback!

Hi Community,

 

Lot of times I see people talking about asyncValidate method for resolving asynchronous calling issues.

For ex.

 

I understand callback concept in javascript but I found it very difficult to understand the use of callback in asyncValidate base method.

I have gone through BaseEditPage, DocumentPageV2 and many more where base asyncValidate has been implemented, but still I didn't understand how these callback and scope are working here specifically.

 

Can someone refer me to any video/article where someone from creatio(creatio developer) are explaining this?

 

Like 1

Like

2 comments

Hi Akshit,

 

I'm not "someone from Creatio (Creatio developer)", but I'll mention that a page in Creatio has many layers each layer might have fields they need to validate. For example, let's say you customize the Account page and add an asyncValidate. Your customized version of the Account page is a layer on top of the base Account page. If the base Account page also needs to use asyncValidate, there needs to be some way to chain all of these async functions together, so it knows when they are all done and can continue with the save or not. So, when one of the asyncValidate functions complete, it executes the callback so that the next "layer" of the  page can run it's asyncValidate. This is how it chains these async functions together, by passing the callback of the next one to the function, so it can tell the next one when they can run (by executing the callback). Does that make sense?

 

Ryan

Hi Ryan,

 

Thanks, Yes It makes sense : )

 

 

Show all comments