[richfaces-issues] [JBoss JIRA] Commented: (RF-6788) Cannot select null value with rich:inplaceSelect

John Leed (JIRA) jira-events at lists.jboss.org
Wed Apr 15 12:32:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/RF-6788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12462400#action_12462400 ] 

John Leed commented on RF-6788:
-------------------------------

I think the problem has to do with how the renderer is decoding:

// RichFaces InplaceSelectBaseRenderer (line 77)

Map <String,String> request = context.getExternalContext().getRequestParameterMap();
String newValue = (String) request.get(clientId);
if (newValue != null && newValue.length()!= 0) {
    inplaceSelect.setSubmittedValue(newValue);
} 
else {
    inplaceSelect.setSubmittedValue(null);
}

	
// Mojarra com.sun.faces.renderkit.html_basic.MenuRenderer (line 237)

Map<String, String> requestParameterMap =
    context.getExternalContext().
    getRequestParameterMap();
if (requestParameterMap.containsKey(clientId)) {
    String newValue = requestParameterMap.get(clientId);
    setSubmittedValue(component, newValue);
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("submitted value for UISelectOne component "
            +
            component.getId()
            + " after decoding "
            + newValue);
    }
	 
} else {
    // there is no value, but this is different from a null
    // value.
    setSubmittedValue(component, RIConstants.NO_VALUE);
}

If a null value was selected, it will be passed through the request as an empty string. Whereas Mojarra sets the submitted value as empty, Richfaces sets the submitted value as null.

During the process validations phase, if the submitted value is null, validation does not continue and setValue is never called:

// UIInput (line 858)

// Submitted value == null means "the component was not submitted
// at all";  validation should not continue
Object submittedValue = getSubmittedValue();
if (submittedValue == null) {
    return;
}

> Cannot select null value with rich:inplaceSelect
> ------------------------------------------------
>
>                 Key: RF-6788
>                 URL: https://jira.jboss.org/jira/browse/RF-6788
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.3.0, 3.3.1
>         Environment: RichFaces 3.3.0 or 3.3.1 Beta 3, Sun Glassfish Enterprise Server
>            Reporter: John Leed
>
> Using rich:inplaceSelect with a SelectItems array with a null value as the first entry to make the selection optional. The rest of the SelectItems are objects and a label with a JSF converter on the class. If the value on the backing bean is not null when the page is first rendered and if the null (value="") item is selected, the bean value does not change on postback.
> Example:
> <h:outputText value="District:"/>
> <rich:inplaceSelect label="District" id="district" value="#{store.currentEntity.district}"
>     defaultLabel="Click to select" >
>     <f:selectItems value="#{district.selectOneItems}"/>
> </rich:inplaceSelect>
> The following works perfectly fine:
> <h:outputText value="District:"/>
> <h:selectOneMenu label="District" id="district" value="#{store.currentEntity.district}">
>     <f:selectItems value="#{district.selectOneItems}"/>
> </h:selectOneMenu>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list