-
1. Re: Problem with a4j:jsFunction data in Richfaces 4
schoenb Jan 27, 2013 5:42 AM (in response to schoenb)Is use Richfaces 4.2.3 - a typo
-
2. Re: Problem with a4j:jsFunction data in Richfaces 4
healeyb Jan 27, 2013 2:27 PM (in response to schoenb)1 of 1 people found this helpfulHere's an example that I have used in the past, there are a few minor changes from your code above, notably the use
of a4j:param and event.data. Hopefully you can adapt this to meet your requirements.
<a4j:commandButton onclick="jsTest();" ...
<a4j:jsFunction name="jsTest"
oncomplete="alert(event.data)"
action="#{bean.jsTestAction}"
data="#{bean.jsTestData}">
<a4j:param name="p1" value="Fred" assignTo="#{bean.jsTestParam}"/>
</a4j:jsFunction>
public String jsTestAction() {
jsTestData = "Hello " + jsTestParam;
return null;
}
Regards,
Brendan.
-
3. Re: Problem with a4j:jsFunction data in Richfaces 4
dadam Jan 28, 2013 3:32 AM (in response to schoenb)Your mistake in receive data via "data" variable, you must take data via "event.data"
This is examle from book:
<h:form>
<input type="button" value="Update" onclick="updateName('Joe');"/>
<a4j:jsFunction name="updateName" render="showname" data="#{jsFunctionNameBean.greeting}" oncomplete="alert(event.data)">
<a4j:param name="param1" assignTo="#{jsFunctionNameBean.name}"/>
</a4j:jsFunction>
<h:outputText id="showname" value="#{jsFunctionNameBean.greeting}"/>
</h:form>
@ManagedBean (name="jsFunctionNameBean")
@RequestScoped
public class JSFunctionNameBean {
private String name; // setter and getter
public String getGreeting () {
return "Hello "+this.name;
}
}
Regards,
Adam.
-
4. Re: Problem with a4j:jsFunction data in Richfaces 4
schoenb Jan 28, 2013 12:52 PM (in response to dadam)Thank you very much. I my overlooked this in the docs.
-
5. Re: Problem with a4j:jsFunction data in Richfaces 4
smilefeng Dec 26, 2014 3:40 AM (in response to dadam)thank you very much for your answer