opened
chongma
username_0
`b:selectOneMenu` doesn't seem to be compatible with `f:ajax`.  for example if i create an `h:selectOneMenu` like
```
<h:selectOneMenu value="#{myBean.value}">
    <f:ajax render="@form"/>
</h:selectOneMenu>
```
 it renders the form on change with the new value without needing tom implement a listener.  if i create
```
<b:selectOneMenu value="#{myBean.value}" update="@form"/>
```
or
```
<b:selectOneMenu value="#{myBean.value}" >
    <f:ajax render="@form"/>
</b:selectOneMenu>
```
 it doesn't update the form (presumably) unless there is a listener.  hope that makes sense
b:selectOneMenu f:ajax
issue
created
stephanrauh
username_1
If there's no AJAX listener, why should the AJAX request be triggered at all?

The original JSF AJAX engine is very simplistic. It generates an AJAX request each time when it finds an `f:ajax` facet. It offers a default event in order to save you a few keystrokes.

The BootsFaces AJAX engine generates AJAX code if it finds a JavaScript attribute with the "ajax:" prefix. If the programmer doesn't declare such an AJAX attribute, it's their fault. We don't generate a default action. 

Later we added compatibility to standard JSF by reluctantly supporting `f:ajax`. We mapped them to our `onClick`etc. approach, so it's little wonder nothing happens when there's neither an actionlistener nor an action.
comment
created
stephanrauh
username_1
That said, I've found a "todo" comment indicating we should improve support for `f:ajax`:

```java
		// TODO behaviors don't render correctly?
		// SR 19.09.2015: looks a bit odd, indeed. The method generateAJAXCall()
		// generates an onclick handler -
		// regardless of which event we currently deal with
		String script = "";
		Map<String, List<ClientBehavior>> clientBehaviors = component.getClientBehaviors();
		List<ClientBehavior> behaviors = clientBehaviors.get(keyClientBehavior);
		if (null != behaviors) {
			for (ClientBehavior cb : behaviors) {
				if (cb instanceof AjaxBehavior) {
					StringBuilder s = generateAJAXCallForClientBehavior(context, (IAJAXComponent) component,
							(AjaxBehavior) cb);
					script += s.toString() + ";";
				} else if (cb.getClass().getSimpleName().equals("AjaxBehavior")) {
					AjaxBehavior ab = new AjaxBehavior();
					Object disabled = readBeanAttribute(cb, "isDisabled");
					ab.setDisabled((Boolean) disabled);
					ab.setOnerror((String) readBeanAttribute(cb, "getOnerror"));
					ab.setRender((Collection<String>) readBeanAttributeAsCollection(cb, "getUpdate"));
					ab.setExecute((Collection<String>) readBeanAttributeAsCollection(cb, "getProcess"));
					ab.setOnevent(keyClientBehavior);
					StringBuilder s = generateAJAXCallForClientBehavior(context, (IAJAXComponent) component, ab);
					script += s.toString() + ";";
				}
			}
		}
		// TODO end
```
comment
created
stephanrauh
username_1
The "todo" method is called only under special circumstances, such as jQuery event. The regular `<f:ajax event="something" />´ API works fine.
comment
created
chongma
username_0
Ok do you want me to test it? Might have to be tomorrow though. I basically changed a working `h:selectOneMenu` and changed to a `b:selectOneMenu` and it stopped working. Let me come back to you on this
comment
created
stephanrauh
username_1
Testing would be appreciated! Just remember that you need to add a `listener` to the `f:ajax` facet. Otherwise, BootsFaces won't do anything because it thinks there's nothing to do. I'm still not sure if I should fix that for the sake of compatibility, or how to deal with that.
comment
created
chongma
username_0
Yes i will try to test what the default behaviour is so you can decide whether or not you want to support the default of the core components
comment
created
stephanrauh
username_1
Great! I've also created a related issue (#717).
comment
created
chongma
username_0
i can confirm that updating to 1.1.0 fixes this issue
comment
closed
chongma
username_0
issue