0

I am having an issue with <h:commandButton> and <a4j:commandButton> in a form with a <rich:pickList> the action fires fine if I remove the <rich:pickList> but the pickList needs to be there.

Is this a known issue and if so is there a work around for it?

This is what the code looks like

    <rich:modalPanel id="editAlbumPanel" width="580" height="255">
    <f:facet name="header">
        <h:panelGroup>
            <h:outputText value="Edit Album #{mainBean.album.title}" styleClass="modal_header_txt" />
        </h:panelGroup>
    </f:facet>
    <f:facet name="controls">
        <h:panelGroup>
            <a4j:commandButton id="closeEditAlbum" image="images/close.png"
                onclick="Richfaces.hideModalPanel('editAlbumPanel');" />
        </h:panelGroup>
    </f:facet>
    <h:form id="editAlbumForm">
        <h:panelGrid columns="2">
            <h:outputText value="Genres" styleClass="descript"/>
            <rich:pickList value="#{mainBean.selectedGenres}" copyControlLabel="Add"
                fastMoveControlsVisible="false">
                <f:selectItems value="#{mainBean.genreSelect}"/>
            </rich:pickList>
            <h:outputText value="Explicit Lyrics: " styleClass="descript"/>
            <h:selectBooleanCheckbox styleClass="spacer" value="#{mainBean.album.explicitLyrics}"/>
        </h:panelGrid>
        <div align="right">
            <a4j:commandButton value="Apply Changes" action="#{mainBean.editAlbumA}"
                oncomplete="Richfaces.hideModalPanel('editAlbumPanel');"/>
            <h:commandButton value="Cancel" styleClass="spacer" onclick="Richfaces.hideModalPanel('editAlbumPanel');"/>
        </div>
    </h:form>
</rich:modalPanel>

EDIT Extra Information

The action method is called if and only if the right hand side of the pick list is empty, aka the user selects no options

4
  • Are you sure that you have just one h:form? And the h:form encapsulates all command buttons or links?
    – Richie
    Feb 10, 2012 at 11:48
  • there is more than 1 h:form but they are all placed outside of each other but still within the f:view. The thing is if i remove the picklist it works fine
    – glenbl54
    Feb 10, 2012 at 12:02
  • why do you want seperate h:forms? Cant you have just one h:form to enclose all command components?
    – Richie
    Feb 10, 2012 at 12:04
  • it's the way I have always worked with modal panels and it's always worked, till now. I place the modalpanel outside the main form
    – glenbl54
    Feb 10, 2012 at 12:11

1 Answer 1

0

I have found the solution, turns out I was passing in an int instead of a String in the select item

1
  • In other words, a conversion error has occurred. You would have been notified about this much sooner if you have used <h:messages> in the view. See also stackoverflow.com/questions/2118656/…
    – BalusC
    Feb 11, 2012 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.