简体   繁体   中英

p:InputTextArea value doesn't get the newest value

I have a strange behaviour in my app and I'm running out of options to solve it, because sometimes it works and other times it doesn't (depending on the component hierarchy). Basically, I'm using an inputTextArea and send the value via setPropertyActionListener to my server for further logic on my application. The feature is actually a list of comments .

<h:panelGroup rendered="#{(cc.attrs.requestCommentListComponentModel.requestCommentEditableMap[requestCommentVar.id]) and (cc.attrs.isModificationAllowed)}">
                                <div>
                                    <p:inputTextarea id="modifyRequestCommentInputTextArea" maxlength="255" styleClass="modifyRequestCommentInputTextArea" value="#{requestCommentVar.comment}" />
                                </div>

                                <h:panelGroup id="modifyRequestCommentControlButtonsPanelGroup" styleClass="requestCommentControlButtonsPanelGroup">
                                    <p:commandButton
                                        id="cancelRequestCommentModificationCommandButton"
                                        action="requestCommentListComponent.cancelEditRequestComment"
                                        onclick="jQuery.simpleBlockUI();cleanWatermark();"
                                        onerror="jQuery.unblockUI();"
                                        oncomplete="showWatermark();jQuery.unblockUI();closeComponent('#entityTaskManagementDialog');closeComponent('#quickTaskDialog');"
                                        process="@none"
                                        styleClass="requestCommentListComponentCommandButton"
                                        value="#{omnimed['global.cancel']}">
                                        <f:setPropertyActionListener target="#{cc.attrs.requestCommentListComponentModel.currentRequestComment}" value="#{requestCommentVar}" />
                                        <f:setPropertyActionListener target="#{conversationScope.requestCommentListComponentModel}" value="#{cc.attrs.requestCommentListComponentModel}" />
                                    </p:commandButton>
                                    <p:commandButton
                                        id="saveRequestCommentModificationCommandButton"
                                        action="requestCommentListComponent.updateRequestComment"
                                        onclick="jQuery.simpleBlockUI();cleanWatermark();"
                                        onerror="jQuery.unblockUI();"
                                        oncomplete="showWatermark();jQuery.unblockUI();closeComponent('#entityTaskManagementDialog');closeComponent('#quickTaskDialog');"
                                        styleClass="postButton requestCommentListComponentCommandButton"
                                        value="#{omnimed['global.save']}">
                                        <f:setPropertyActionListener target="#{cc.attrs.requestCommentListComponentModel.currentRequestComment}" value="#{requestCommentVar}" />
                                        <f:setPropertyActionListener target="#{conversationScope.requestCommentListComponentModel}" value="#{cc.attrs.requestCommentListComponentModel}" />
                                    </p:commandButton>
                                </h:panelGroup>
                            </h:panelGroup>

So, the problem is when I get the value ( #{requestCommentVar.comment} ) with the setPropertyActionListener. There's is a value, but it is always the old one (aka the one stored in the model). If I enter a new text, it still give me back to old value with no errors. I've done this implementation before and it worked.

Also, I should say that I have a component within another component. So, I have a datatable (ui-repeat) of Class A for which each contains also a datatable (ui-repeat) of Class B in my parent level component. Then I have a child component, which have a datatable (ui-repeat) of my class C for each Class A. Class C are actually a list of comments and I have a problem when I'm trying to modify a comment.

Please add process attribute to your commandButton like process="@this,modifyRequestCommentInputTextArea"

Thanks, Pankaj

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM