Note that there are some explanatory texts on larger screens.

plurals
  1. POjsf: selectonemenu not getting last value
    primarykey
    data
    text
    <p>Whenever I select last value (<strong>OPTION 12</strong>) from dropdown it always show first option. Other than that it work fine. IF I remove thi line</p> <pre><code>&lt;f:selectItem itemValue="0" noSelectionOption="true" itemLabel="Select One Option" /&gt; </code></pre> <p>it works fine.</p> <p>Can anybody give some explaination so that i can get it work including above line.</p> <p><strong>ManagedBean</strong></p> <pre><code>public class ReportUitility implements java.io.Serializable { private List&lt;SelectItem&gt; list = null; public ReportUitility() { reportType = "0"; list = new ArrayList&lt;SelectItem&gt;(); list.add(new SelectItem("1","OPTION 1" )); list.add(new SelectItem("2","OPTION 2")); list.add(new SelectItem("3","OPTION 3")); list.add(new SelectItem("4","OPTION 4" )); list.add(new SelectItem("5","OPTION 5")); list.add(new SelectItem("6","OPTION 6")); list.add(new SelectItem("7","OPTION 7")); list.add(new SelectItem("8","OPTION 8")); list.add(new SelectItem("9","OPTION 9")); list.add(new SelectItem("10","OPTION 10")); list.add(new SelectItem("11","OPTION 11")); list.add(new SelectItem("12","OPTION 12")); } public List&lt;SelectItem&gt; getList() { return list; } public String getReportType() { return reportType; } public void setReportType(String reportType) { this.reportType = reportType; } public void valueChangeEffect(ValueChangeEvent vce) { if ((Integer.parseInt(vce.getNewValue().toString()) - 1) &gt;= 7) { //some stuff } else { // some stuff } } } </code></pre> <p><strong>JSF PAGE CODE</strong></p> <pre><code>&lt;p:selectOneMenu id="selectReportType" required="true" value="#{reportUitility.reportType}" valueChangeListener="#{reportUitility.valueChangeEffect}"&gt; &lt;f:selectItem itemValue="0" noSelectionOption="true" itemLabel="Select One Option" /&gt; &lt;f:selectItems value="#{reportUitility.list}" /&gt; &lt;p:ajax event="change" update="selectReportType,gradeFrom,gradeTo,exportToXLS,exportToText"/&gt; &lt;/p:selectOneMenu&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload