each ajax command in Ajax4jsf has a 'data' attribute. You can pass any data there and then use in oncomplete call.
So, you can assign some property in the backing bean and set it from the action method. If validation is OK, the action is invoked and the property is set. Otherwise, it will default value. Let 'data' attribute point to this property using EL. On the client side you can use this value to fork the behavior.
See jsFunction example how you can access to the 'data' from oncomplete
Thanks for the quick reply. I'm aware that in jsFunction#oncomplete, the data variable is a JSON version of whatever you specify in the data attribute of the component. However, how does one specify what data will be in an a4j:commandButton? Does a4j:commandButton have an undocumented data attribute as well?
Good joke, Jose.
Only one problem with tld doc now. Attributes are not mentioned in the alphabetical order. However, the 'data' is there for each of the ajax command component.
Wow. I must have read that listing a hundred times and never saw the data attribute. Thanks Sergey! I wound up creating a utility Seam Component which returns statistics on the previously invoked action (e.g., error count, max severity, etc). I can't wait to add this feature to the base A4J action component once the source is available.
You don't need a special bin for a check validation errors. For a error level can be used FacesContext: