FeedbackPanel.anyErrorMessage() Strange Behavior

View: New views
1 Messages — Rating Filter:   Alert me  

FeedbackPanel.anyErrorMessage() Strange Behavior

by TH Lim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

My intention was to use the same feedback panel to show both info and error messages. What I did was if there there is a mistake e.g. blank textfield, feedback panel will display and error and expects the user to fix his mistake and submit again. If the form is filled in accordingly, an info message will inform him that his information is captured. The problem I faced was, I used FeedbackPanel.anyErrorMessage() to check if any error was attached to the panel otherwise show an acceptance message using FeedbackPanel.info(...). However, the info message is not shown. If I didn't invoke FeedbackPanel.anyErrorMessage() and use a boolean flag to track errors, the info message will show.

<code>
...
 if (messageModel.getObject() == null || messageModel.getObject().toString().length() == 0)
                {
                    error("Message must not be empty.");
                }
                if (feedback.anyErrorMessage())
                {
                    return;
                }
                // will not show in feedback panel when there is no error
                info("Your message is " + messageModel.getObject());
...
</code>

I have also included full codes to demonstrate what I mean. TQ

TestFeedbackPanelPage.java
TestFeedbackPanelPage.html
LightInTheBox - Buy quality products at wholesale price