Hello,
I am trying to modify chiba code in order to
perform the following
- when triggering revalidate, to show the alert messages of
invalid nodes (similarly to what happens when submitting).
I am running one of the sample files (orderlist.xhtml) and have
modified the code a little (Container.class) in order
to throw exception when the event to be dispatched is “xforms-invalid “ which
happens when a node is not valid (e.g. when putting “aaa” for
amount)
---
public boolean dispatch(EventTarget eventTarget, String eventType,
Object info) throws XFormsException {
….
if (event.getType().equals("xforms-invalid")){
throw new XFormsException("Invalid node");
}
---
however, nothing happens except that chiba prints the
exception.
DEBUG org.chiba.xml.xforms.events.EventFactory : creating
event xforms-invalid
DEBUG org.chiba.xml.xforms.Container : dispatch: xforms-invalid
to [xforms:input
: null]
DEBUG org.chiba.xml.xforms.Container : dispatch: cancelable:
false
DEBUG org.chiba.xml.xforms.Container : dispatch: bubbles:
true
DEBUG org.chiba.xml.xforms.Container : [xforms:input: null]
org.chiba.xml.xforms.exception.XFormsException: Invalid node
at org.chiba.xml.xforms.Container.dispatch(Container.java:364)
…..
I wonder if I should create some event to activate the alert
of the invalid node or to focus on it e.g.
--
public boolean dispatch(EventTarget eventTarget, String eventType,
Object info) throws XFormsException {
….
if (event.getType().equals("xforms-invalid")){
event.getTarget().dispatchEvent(EventFactory.createEvent(EventFactory.FOCUS));
}
--
however the above does not do anything either.
I am new to chiba so forgive me if I
am missing something really obvious here.
Thank you
Giota