Hi
How can i trigger a function in my bean after onchange selectOneMenu?
Example, i have a function call abc.
I have this code: onchange="jQuery('#form').submit()"
What must i modify the code above to call abc after onchange?
Thks
Onchange selectOneMenu [SOLVED]
Hello garyyip,
You can use <p:ajax> for that. Here is an example:
http://www.primefaces.org/showcase/ui/ajaxifyAction.jsf
You can use <p:ajax> for that. Here is an example:
http://www.primefaces.org/showcase/ui/ajaxifyAction.jsf
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,
for <p:ajax>'s attributes, view User Guide page 353.
if you don't get all attributes, it is because your IDE doesn't support them.
if you don't get all attributes, it is because your IDE doesn't support them.
JSF-2.0, mojarra-2.0.2-FCS and PrimeFaces-2.1 on GlassFish v3.0.1 (build 22)
So you are using eclipse .
I would suggest to change to Netbeans but if you need/want to use eclipse you can get help here:
http://cagataycivici.wordpress.com/2010 ... se-helios/
I would suggest to change to Netbeans but if you need/want to use eclipse you can get help here:
http://cagataycivici.wordpress.com/2010 ... se-helios/
PrimeFaces 3.0, Glassfish 3.1.2, Mojarra 2.1.6,
Hi All, I've the same problem, any solution please!!!
this is my code
I use pf 2.2 M1 and nb 6.9.1
this is my code
Code: Select all
<div class="div_texbox">
<h:selectOneMenu value="#{testBean.testCategory}">
<f:selectItems id="cattest" var="cat" value="#{examenBean.testCategories}" itemLabel="#{cat.name}"
itemValue=""/>
<p:ajax update="subtest" event="change" actionListener="#{testBean.handleCatChange}" process="cattest"/>
</h:selectOneMenu>
</div>
<div class="div_texbox">
<h:selectOneMenu id="subtest" value="#{testBean.testtype}">
<f:selectItems var="test" value="#{examenBean.testTypes}" itemLabel="#{test.name}"
itemValue=""/>
</h:selectOneMenu>
</div>
Netbeans 6.9.1 , GlassFish 3.0.1, Mojarra 2.0.3 , primefaces 2.2 rc2
@fayca121
In 2.2.M1 the p:ajax tag has listener attribute. The actionListener attribute no longer exists. See the following example in the showcase: http://www.primefaces.org/showcase/ui/ajaxifyAction.jsf.
In 2.2.M1 the p:ajax tag has listener attribute. The actionListener attribute no longer exists. See the following example in the showcase: http://www.primefaces.org/showcase/ui/ajaxifyAction.jsf.
Hi , the problem is when I put a value at itemValue attribute, the event (listener="#{testBean.handleCatChange}") doesn't fire.
it works only when itemValue is empty !!!!!
what's wrong please?
it works only when itemValue is empty !!!!!
what's wrong please?
Netbeans 6.9.1 , GlassFish 3.0.1, Mojarra 2.0.3 , primefaces 2.2 rc2
The process attribute in the p:ajax tag is set to "cattest", but cattest is not the id of a component. Remove the process attribute from the p:ajax tag. Remove the id="cattest" from the f:selectItems tag also.
If a cat is an object of a type that has both a name and a value property, something similar to the following should work:
I assume handleCatChange looks something like this:
If a cat is an object of a type that has both a name and a value property, something similar to the following should work:
Code: Select all
<h:selectOneMenu value="#{testBean.testCategory}">
<f:selectItems var="cat" value="#{examenBean.testCategories}" itemLabel="#{cat.name}" itemValue="#{cat.value}"/>
<p:ajax update="subtest" event="change" listener="#{testBean.handleCatChange}"/>
</h:selectOneMenu>
Code: Select all
public void handleCatChange() {
...
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 32 guests