Monday, December 7, 2009

Disable Page Validation on Ajax Calls

All page validations could be disabled, while making ajax calls. In certain business logic we might need to refresh data regularly from the server, which would make repeated round trip calls to the server, which might cause the page validations to fire; when calls made to server.
We could handle above scenario as
[a4j:support id="refreshBtnAjax" event="onclick"
           onsubmit="Lifecycle.setValidateForm(false);" 
           oncomplete="Lifecycle.setValidateForm(true);"                           
           actionListener="#{controller.action}"
           reRender="ComponentName" immediate="true"/]
Could disable the validation on submitting the ajax request and enabling the validations when the ajax request is complete.

No comments:

Post a Comment