-
1. Re: JSF Validation and oncomplete handlers
sergeysmirnov May 14, 2007 6:27 PM (in response to loopingrage)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 -
2. Re: JSF Validation and oncomplete handlers
loopingrage May 14, 2007 6:48 PM (in response to loopingrage)Sergey,
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? -
3. Re: JSF Validation and oncomplete handlers
sergeysmirnov May 14, 2007 7:10 PM (in response to loopingrage)Good joke, Jose.
see: http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/tlddoc/index.html
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. -
4. Re: JSF Validation and oncomplete handlers
loopingrage May 16, 2007 12:12 PM (in response to loopingrage)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.
Thanks again,
Jose -
5. Re: JSF Validation and oncomplete handlers
alexsmirnov May 16, 2007 6:35 PM (in response to loopingrage)You don't need a special bin for a check validation errors. For a error level can be used FacesContext:
data="#{context.maximumSeverity}"