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



Feb 22, 2011, 1:27 PM
66 Posts

Tabbed Panel - Validate tab switching w/ SSJS validations

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: Tabbed Panel,SSJS
  • Replies: 3
Does anyone know of a  good way to validate a tab in a Tabbed Panel control with SSJS validations?
 
For example: On tab 1, if First Name and Last Name are blank and a user clicks on tab 2, do not switch and alert a message to a user.
 
I know there is the onlclick Event for the Tabbed Panel and I have a function that is callled there and I can validate the data just fine. I am just at a roadblock trying to figure out how to prevent the tab from switching based on certain factors and alerting the user with SSJS.

Any help is greatly appreciated.
Feb 22, 2011, 2:31 PM
586 Posts
Re: Tabbed Panel - Validate tab switching w/ SSJS validations
I've not done a lot with validation yet...  BUT I'm not a fan of the XPages built in Tab Control.  I prefer to do it manually in Dojo.  the reason is that for the XPages control - only the ACTIVE tab contents are sent to the browser.  So clicking on a tab causes a round trip to the server and a partial refresh.
 
doing it in Dojo manually, all the content is set to the browser so you can really validate it all at once with Client Side JavaScript if you like.

Here's a snippet if you need it.  you would still need to turn dojo on and include these modules...

<xp:panel dojoType="dijit.layout.TabContainer"
    style="width: 350px; height: 300px">
    <xp:panel dojoType="dijit.layout.ContentPane" title="dojo Tab 1">
        Content for Tab 1
    </xp:panel>
    <xp:panel dojoType="dijit.layout.ContentPane" title="dojo Tab 2">
        Content for Tab 2
    </xp:panel>
    <xp:panel dojoType="dijit.layout.ContentPane" title="dojo Tab 3">
        Content for Tab 3
    </xp:panel>
</xp:panel>
 
hope that helps...
Feb 22, 2011, 3:03 PM
9 Posts
Re: Tabbed Panel - Validate tab switching w/ SSJS validations
 Go to OpenNTF and download the XPages Extension Library. This will provide you with the Dojo tabbed pane. The Dojo version has events like onShow that you can attach code to.
Feb 22, 2011, 7:22 PM
66 Posts
Re: Tabbed Panel - Validate tab switching w/ SSJS validations
Thanks for the tips guys. We do not have the Extension Library loaded yet, but plan to install it soon.
 
I came across an article by Andre Guirard that almost does what I'm looking for: http://www-10.lotus.com/ldd/bpmpblog.nsf/dx/better-ssjs-validation-for-xpages?opendocument&comments

The only thing with this is that validations are put on every field. It would be more manageable if there was someway to include these validations in a SSJS library so I'm going to be checking into that...if anyone has any ideas/suggestions let me know!

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