[richfaces-issues] [JBoss JIRA] (RF-11606) rich:select : doesn't cast selectItem value
Frederic Allard (Updated) (JIRA)
jira-events at lists.jboss.org
Fri Oct 28 10:21:45 EDT 2011
[ https://issues.jboss.org/browse/RF-11606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Frederic Allard updated RF-11606:
---------------------------------
Steps to Reproduce:
- Declare an Integer property in a managed bean and set a default value;
{code:title=PagerBean.java|borderStyle=solid}
private Integer page = 20;
public Integer getPage() {...}
public Integer setPage(Integer page) {...}
{code}
- Bind the property to a rich:select;
- Define f:selectItem(s);
{code:title=page.xhtml|borderStyle=solid}
<rich:select value="#{pagerBean.page}">
<f:selectItem itemValue="5" itemLabel="5" />
<f:selectItem itemValue="10" itemLabel="10" />
<f:selectItem itemValue="20" itemLabel="20" />
<f:selectItem itemValue="40" itemLabel="40" />
</rich:select>
{code}
- Render the page and the value 20 will not be selected, but it will be rendered in the input:hidden of the component in the page source.
{code:title=page.xhtml source|borderStyle=solid}
<div class="rf-sel" id="j_idt114:j_idt187:j_idt165">
<span class="rf-sel-cntr">
<input id="j_idt114:j_idt187:j_idt165selValue" name="j_idt114:j_idt187:j_idt165" type="hidden" value="20" />
<input autocomplete="off" class="rf-sel-inp rf-sel-dflt-lbl" id="j_idt114:j_idt187:j_idt165Input" name="j_idt114:j_idt187:j_idt165Input" readonly="readonly" type="text" />
<span class="rf-sel-btn" id="j_idt114:j_idt187:j_idt165Button">
<span class="rf-sel-btn-arrow"></span>
</span>
</span>
<div class="rf-sel-lst-cord" id="j_idt114:j_idt187:j_idt165List">
<div class="rf-sel-shdw">
<div class="rf-sel-shdw-t"></div>
<div class="rf-sel-shdw-l"></div>
<div class="rf-sel-shdw-r"></div>
<div class="rf-sel-shdw-b"></div>
<div class="rf-sel-lst-dcrtn">
<div class="rf-sel-lst-scrl" style="min-height: 20px;max-height: 100px;width: 30px">
<div id="j_idt114:j_idt187:j_idt165Items">
<div id="j_idt114:j_idt187:j_idt165Item0" class="rf-sel-opt">5</div>
<div id="j_idt114:j_idt187:j_idt165Item1" class="rf-sel-opt">10</div>
<div id="j_idt114:j_idt187:j_idt165Item2" class="rf-sel-opt">20</div>
<div id="j_idt114:j_idt187:j_idt165Item3" class="rf-sel-opt">40</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">new RichFaces.ui.Select("j_idt114:j_idt187:j_idt165", {"clientSelectItems":[{ 'id' : "j_idt114:j_idt187:j_idt165Item0" , 'label' : "5", 'value' : "5"},{ 'id' : "j_idt114:j_idt187:j_idt165Item1" , 'label' : "10", 'value' : "10"},{ 'id' : "j_idt114:j_idt187:j_idt165Item2" , 'label' : "20", 'value' : "20"},{ 'id' : "j_idt114:j_idt187:j_idt165Item3" , 'label' : "40", 'value' : "40"}] ,"itemCss":"rf\u002Dsel\u002Dopt","selectItemCss":"rf\u002Dsel\u002Dsel","onselectitem":function(event){RichFaces.ajax(this,event,{"parameters":{"javax.faces.behavior.event":"selectitem","org.richfaces.ajax.component":"j_idt114:j_idt187:j_idt165"} ,"sourceId":this} )}} );</script>
</div>
{code}
- If you change the property page's type in the PageBean to String, the value will be selected after rendering the page.
was:
- Declare an Integer property in a managed bean and set a default value;
{code:title=PagerBean.java|borderStyle=solid}
private Integer page = 20;
public Integer getPage() {...}
public Integer setPage(Integer page) {...}
{code}
- Bind the property to a rich:select;
- Define f:selectItem(s);
{code:title=page.xhtml|borderStyle=solid}
<rich:select value="#{pagerBean.page}">
<f:selectItem itemValue="5" itemLabel="5" />
<f:selectItem itemValue="10" itemLabel="10" />
<f:selectItem itemValue="20" itemLabel="20" />
<f:selectItem itemValue="40" itemLabel="40" />
</rich:select>
{code}
- Render the page and the value 20 will not be selected, but it will be rendered in the input:hidden of the component in the page source.
{code:title=page.xhtml source|borderStyle=solid}
<div class="rf-sel" id="j_idt114:j_idt187:j_idt165">
<span class="rf-sel-cntr">
<input id="j_idt114:j_idt187:j_idt165selValue" name="j_idt114:j_idt187:j_idt165" type="hidden" value="20" />
<input autocomplete="off" class="rf-sel-inp rf-sel-dflt-lbl" id="j_idt114:j_idt187:j_idt165Input" name="j_idt114:j_idt187:j_idt165Input" readonly="readonly" type="text" />
<span class="rf-sel-btn" id="j_idt114:j_idt187:j_idt165Button">
<span class="rf-sel-btn-arrow"></span>
</span>
</span>
<div class="rf-sel-lst-cord" id="j_idt114:j_idt187:j_idt165List">
<div class="rf-sel-shdw">
<div class="rf-sel-shdw-t"></div>
<div class="rf-sel-shdw-l"></div>
<div class="rf-sel-shdw-r"></div>
<div class="rf-sel-shdw-b"></div>
<div class="rf-sel-lst-dcrtn">
<div class="rf-sel-lst-scrl" style="min-height: 20px;max-height: 100px;width: 30px">
<div id="j_idt114:j_idt187:j_idt165Items">
<div id="j_idt114:j_idt187:j_idt165Item0" class="rf-sel-opt">5</div>
<div id="j_idt114:j_idt187:j_idt165Item1" class="rf-sel-opt">10</div>
<div id="j_idt114:j_idt187:j_idt165Item2" class="rf-sel-opt">20</div>
<div id="j_idt114:j_idt187:j_idt165Item3" class="rf-sel-opt">40</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">new RichFaces.ui.Select("j_idt114:j_idt187:j_idt165", {"clientSelectItems":[{ 'id' : "j_idt114:j_idt187:j_idt165Item0" , 'label' : "5", 'value' : "5"},{ 'id' : "j_idt114:j_idt187:j_idt165Item1" , 'label' : "10", 'value' : "10"},{ 'id' : "j_idt114:j_idt187:j_idt165Item2" , 'label' : "20", 'value' : "20"},{ 'id' : "j_idt114:j_idt187:j_idt165Item3" , 'label' : "40", 'value' : "40"}] ,"itemCss":"rf\u002Dsel\u002Dopt","selectItemCss":"rf\u002Dsel\u002Dsel","onselectitem":function(event){RichFaces.ajax(this,event,{"parameters":{"javax.faces.behavior.event":"selectitem","org.richfaces.ajax.component":"j_idt114:j_idt187:j_idt165"} ,"sourceId":this} )}} );</script>
</div>
{code}
> rich:select : doesn't cast selectItem value
> -------------------------------------------
>
> Key: RF-11606
> URL: https://issues.jboss.org/browse/RF-11606
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-selects
> Affects Versions: 4.1.0.Milestone2
> Environment: Internet Explorer 8, Google Chrome 14, Oracle Weblogic 11g
> Reporter: Frederic Allard
> Labels: rich:select, richfaces4
>
> If you define f:selectItem(s) directly in the xhtml file as children of a rich:select, the values of the selectItem(s) are not cast to the bound value of the rich:select.
> This results in the value to be not selected by the rich:select after rendering the page.
> As the documentation of the component says: "The rich:select component is designed to replace standard h:selectOneMenu."
> The h:selectOneMenu casts and selects the value in this case.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list