This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 8, 2012, 12:14 PM
50 Posts
topic has been resolvedResolved

Display Errors Control sort order

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: Errors,sorting
  • Replies: 5
This is a repost of a previously unanswered post by Alison Chapple on 5/11/2011: Is there any way to sort the errors that appear in the display errors control?  I'd like them to show up in the same order as the fields on form, but they are all over the place. I thought it might be in the order of field type (list, text, etc), but that doesn't seem to apply either.  Thanks
Jun 8, 2012, 9:26 PM
129 Posts
Re: Display Errors Control sort order
I've created a custom control that improves on the standard "Display Errors" control. It should show the error messages in the order that they're in the page.
 
The source code for the custom control can be found here: 
http://dontpanic82.blogspot.no/2011/07/custom-control-for-enhanced-validation.html
Jun 11, 2012, 4:45 PM
50 Posts
Re: Display Errors Control sort order
Thanks, Tommy. I follow your blog and saw your entry there this morning and tried it out. It works great! The only difference I get is that the link is generated on the validation message rather than the label text. If that bugs me enough I'll look closer and fix it.
Jun 11, 2012, 5:22 PM
129 Posts
Re: Display Errors Control sort order
When I look at the source code, it looks like I've changed the behaviour since I took the screen shot. I can't remember why I did this.
 
I've updated the source code in the blogpost so that it behaves the same as in the screen shot. Thanks for letting me know :)
Jun 12, 2012, 3:01 PM
50 Posts
Re: Display Errors Control sort order
Tommy, I'm so relieved that I am not the only one who forgets what I have done and why I did it!  ;-)
 
I made one "improvement" to your code that makes the errors list display using the oneui css. I wrapped the repeat control in a <ul> tag, removed the <br /> tag and wrapped the label/message lines in a <li> tag. It looks like this:
 
<xp:div styleClass="xspMessage"rendered="#{javascript:return ( getComponent( 'messageRepeat' ).getRowCount() > 0 );}">
    <ul> 
        <xp:repeat id="messageRepeat" rows="30" value="#{viewScope.messageObjects}" var="messageObject">
               <xp:this.facets>
                    <xp:text value="Validation errors:" xp:key="header" tagName="strong" />
               </xp:this.facets>
               <li> 
                   <a href="#" onclick="return EMessages.setFocus( '#{messageObject.clientId}');">
                        <xp:text value="#{messageObject.label}" />
                   </a>
                   <xp:text value="#{messageObject.message}" />
            </li>
        </xp:repeat>
    </ul>
</xp:div>
 
The result is padding, color, etc that follows that of the Display Errors core control. I posted on your blog as well.
 
Thanks
Jun 13, 2012, 6:13 AM
129 Posts
Re: Display Errors Control sort order
Edit: I found the reason why the message had the link instead of the label. If there isn't specified a label for a field, there won't be a label -> no link with the previous code. I've also updated the code so that it shows a link on the message if no label is specified.
 
I've implemented your suggestion in the blogpost with the source. I suspect the reason I did what I did had something to do with the app I first wrote the custom control for. I think we had some custom css that messed with the layout of the xspMessage.
 
Anyways. Could you mark the post as resolved if the custom control solved your issue. That makes it easier when people are looking for a similar answer in the future.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal