An analysis of the ACE text entry components was made to understand how they behave and what behaviors they have in common. The following is a summary of the findings.
First, the ace:maskedEntry component was compared to the standard h:inputText component. It was found that they have the exact same behavior when it comes to the valueChange event (either via an ajax tag or via the valueChangeListener attribute). This is how they behave with different configurations:
- When h:inputText has an f:ajax tag for the valueChange event with a listener AND a valueChangeListener attribute defined, and when ace:maskedEntry has an ace:ajax tag for the valueChange event with a listener AND a valueChangeListener attribute defined as well.
-> When tabbing out or clicking outside the text field, an ajax behavior request is made and both the ajax listener and the valueChangeListener method are fired.
-> When pressing enter, an ice.s request is made and only the valueChangeListener method is fired.
Note that when pressing enter, a full submit is made by the bridge, not by the component itself. This is an ice.s request, and it doesn't contain the necessary request parameters for the ajax behavior to be triggered.
- When h:inputText and ace:maskedEntry only have a valueChangeListener attribute defined.
-> When tabbing out or clicking outside the text field, no request to the server is made whatsoever.
-> when pressing enter, request is made (bridge), listener is fired
- When h:inputText has an f:ajax tag for the valueChange event with a listener, and when ace:maskedEntry has an ace:ajax tag for the valueChange event with a listener.
-> When tabbing out or clicking outside the text field, an ajax behavior request is made, firing the ajax behavior listener.
-> when pressing enter: a request is made by the bridge, but the ajax behavior listener isn't fired.
So, it could be said that the intention of pressing enter is to make full submits, since that also happens with plain input text HTML elements. Also, we can say that the valueChange event is not so ajaxified.
Other components behave in similar ways.
ace:textEntry
- It doesn't have an ace:ajax valueChange event.
- with valueChangeListener shows the same behavior as h:inputText and ace:maskedEntry.
ace:textAreaEntry
- It doesn't have an ace:ajax valueChange event.
- Same behavior as ace:textEntry, except that pressing enter doesn't initiate a request (it simply moves to the next line in the text area).
ace:autoCompleteEntry
- It doesn't have an ace:ajax valueChange event.
- With valueChangeListener, it fires the method at every keypress, even up/down arrows. It doesn't fire when tabbing out or clicking outside, since the change in value was already registered at the key press event.
ace:richTextEntry
- It doesn't have an ace:ajax valueChange event.
- The tab and enter keys are trapped by the CKEditor, so no requests are made when pressing them.
- Clicking outside the editor doesn't initiate any request either.
- The valueChangeListener method is only fired when pressing the 'Save' button (if the value actually changed).
Attached test case that shows issue. Steps: