-
1. Re: ajaxSingle not working
ilya_shaikovsky Nov 4, 2008 12:30 PM (in response to bjm88)Please try to wrap the select only with a4j:region instead of ajaxSingle using.
b.t.w. why do you need bindings to the components and what about scopes of the beans? And why do you think that all the page updated? you could check client side updates with a4j:log component -
2. Re: ajaxSingle not working
bjm88 Nov 4, 2008 2:23 PM (in response to bjm88)Thank you for the reply Ilya. I tried taking out the binds wrapping just select in a4j:region and removing a4j single. Nothing worked, same result, get long hang time like something is wrong, then refresh to blank page or only thing left is text box in the reRender. Funny thing is it has the auto-populated value, so all back end working (no db, all in memory, which is why I thought long hang is weird too).
I added the a4j:log you suggested and that had some interesting information. Here is some of it:
debug[13:43:48,798]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: change
debug[13:43:48,798]: NEW AJAX REQUEST !!! with form :compPlanFilterForm
debug[13:43:48,814]: Append select-one control compPlanFilterForm:commArrangementCode with value [908] and value attribute [908]
.....
debug[14:09:25,078]: Replace content of node by outerHTML()
error[14:09:25,093]: Error to clear node content by innerHTML Unknown runtime error
debug[14:09:25,093]: search for elements by name 'script' in element input
.....
I've stripped down a test page to just this, and still have same problem
<f:view>
<a4j:form id="testForm">
<a4j:log level="ALL" popup="false" width="600" height="400" />
<h:selectOneMenu id="commArrangementCode"
value="#{compPlanViewerMB.compPlanSearch.commArrangementCode}"
valueChangeListener="#{compPlanViewerMB.caoChangeEvent}">
<f:selectItem itemValue=" " itemLabel=" " />
<f:selectItems value="#{contextRefData.commArrgmtOffices}" />
<a4j:support event="onchange" reRender="caoNameTest"/>
</h:selectOneMenu>
<h:inputText id="caoNameTest" value="#{compPlanViewerMB.commArrangementName}" />
</a4j:form>
</f:view>
Also in Firefox I get this JS errors:
Error: syntax error
Source File: http://localhost:9085/basicscompmgmt/faces/jsf/common/jsfTileNavigator.jsp?javax.portlet.faces.DirectLink=true
Line: 2, Column: 63
Source Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Its like entire document coming back in response, and not sure what this javax.portlet.faces.DirectLink=true is, thats not from our application. -
3. Re: ajaxSingle not working
bjm88 Nov 4, 2008 4:46 PM (in response to bjm88)Think this is a problem with h:inputText. I retested using an h:outputText and it ajax updates just fine. I tried wrapping everything in an a4j:region and pointing to the region in my reRender but that still didn't update the input text box correctly. I think based on the a4j:log output some javascript is trying to update an INPUTs "innerHTML", which would be a problem as inputs does have innerHTML attributes in the DOM, would have to update its ".value". Is this RichFaces bug? Can anyone reproduce problems with inputText components? I also had similar problem using the RichFaces suggestion box, thinking its related.
-
4. Re: ajaxSingle not working
fabmars Nov 4, 2008 6:00 PM (in response to bjm88)Another victim...
http://ishabalov.blogspot.com/2007/08/sad-story-about-uiinput.html
Maybe this won't help in this precie case but I happen to use this shock therapy:public static void clearInputs(UIComponent comp) { if (comp != null) { if (comp instanceof UIInput) { UIInput input = (UIInput) comp; input.setSubmittedValue(null); input.setValue(null); // this is the local value } else { for (UIComponent child : comp.getChildren()) { clearInputs(child); } } } }
-
5. Re: ajaxSingle not working
bjm88 Nov 5, 2008 9:39 PM (in response to bjm88)Thanks for the info, however this did not help me. I tried using your code, clearing the local and submitted values myself and variations along these lines with no change in the behavior, getting the JS error about innerHTML. Searching web found this on RichFaces:
https://jira.jboss.org/jira/browse/RF-2735
This this is RichFaces bug, perhaps related to IE and FireFox partially following the W3C standards for block content within and other structures. At this point I may be giving up on using RichFaces for this, could have done this in 1min with prototype and struts. -
6. Re: ajaxSingle not working
bjm88 Nov 5, 2008 9:41 PM (in response to bjm88)Can anyone just get a pull down to populate a text box with RichFaces?, anything to populate an inputText ? If you can please post code, thx.
-
7. Re: ajaxSingle not working
nbelaevski Nov 5, 2008 10:24 PM (in response to bjm88)Hi,
This behavior is caused by specifics of request handling in RF 3.1.5 caused by JSF 1.1 support. Consider upgrading to 3.2.x/JSF 1.2 or try this:<?xml version="1.0" encoding="UTF-8"?> <jsp:root version="2.1" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/> <jsp:output omit-xml-declaration="no" doctype-root-element="html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <f:view> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <h:form id="testForm"> <h:selectOneMenu id="commArrangementCode" value="#{forum11Bean.selectValue}"> <f:selectItem itemValue="1" itemLabel="1" /> <f:selectItem itemValue="2" itemLabel="2" /> <f:selectItem itemValue="3" itemLabel="3" /> <f:selectItem itemValue="4" itemLabel="4" /> <a4j:support event="onchange" reRender="caoNameTest" ajaxSingle="true" actionListener="#{forum11Bean.resetInputValue}" /> </h:selectOneMenu> <h:inputText id="caoNameTest" value="#{forum11Bean.inputValue}" /> </h:form> </body> </html> </f:view> </jsp:root>
package org.richfaces; import javax.faces.component.EditableValueHolder; import javax.faces.event.ActionEvent; public class Forum11Bean { private String selectValue; public String getSelectValue() { return selectValue; } public void setSelectValue(String selectValue) { this.selectValue = selectValue; } private String inputValue; public String getInputValue() { return inputValue; } public void setInputValue(String inputValue) { this.inputValue = inputValue; } public void resetInputValue(ActionEvent event) { EditableValueHolder holder = (EditableValueHolder) event.getComponent().findComponent("caoNameTest"); holder.setValue(selectValue); holder.setSubmittedValue(null); } }