LukeT
LukeT

Reputation: 83

JSF ActionListener doesn't fire

Action listener that calls function vcardController.renderModify doesn't fire (in the function renderModify I set the variable renderHiddenEdit to true) and the panel in editCardForm doesn't render. Somebody can help me?

<h:form id="editCardForm">
                <p:panel id="editCard"  style="">
                    <p:panel rendered="#{vcardController.renderHiddenEdit}" >
                        <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                        <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                        <h:graphicImage alt="" style="width: 3em;" class="imagesearch" url="#{resource['img:user.svg']}"/>
                    </p:panel>
                </p:panel>
            </h:form>

            <h:form id="viewCardForm">
                <p:panel id="viewCard" style="">
                    <p:panel rendered="#{vcardController.renderHidden}" >
                        <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                        <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                        <p:commandButton
                            id="testmodifica"
                            class="mod nocorner modifycard"
                            value="modify"
                            update=":editCardForm"
                            actionListener="#{vcardController.renderModify}" />
                    </p:panel>
                </p:panel>
            </h:form> 

            <h:form id="formReqEdit" class="formReqEdit" style="display: none;">
                <h:inputHidden id="vcardraw" value="#{vcardController.vcardRaw}" />
                <h:inputHidden id="resourceid" value="#{vcardController.resourceId}" />
                <p:commandButton
                    id="requestForm"
                    style="display: none;"
                    update=":viewCardForm"
                    oncomplete="contactsDOMAction.showCard(xhr, status, args)"
                    actionListener="#{vcardController.activateModifyCard}" />   
            </h:form> 

Upvotes: 0

Views: 445

Answers (1)

Damian S.
Damian S.

Reputation: 149

  1. If you want render "editCardForm" you must put "editCardForm" in update parameter in command button
  2. Good practice is add "process". Then you are sure what data from components will be send to bean, in your case process="@this" if you want only call action listener.

  3. Rafa Hernández says right, how you want press button if it has display:none?

Upvotes: 1

Related Questions