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



Jul 11, 2012, 7:18 AM
21 Posts

Validate combination of 2 fields

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 2
Hi,
 
I'm a bit confuse on how validation works as I am very new in XPages...
What I am trying to do is to validate the combination of 2 fields
 
1) Let say the 2 fields is "Make" and "Model" 
2) I already create a view and name as "ViewCar" 
3) I enter a data - Make is "Honda" and Model is "CRV" ( I combine and it become "HondaCRV")
4) I want to enter a new data and I want to make sure I will not enter the same  data.
 
How can I do this? Can I just use validator to check this and prompt me. 
 
TQ. 
 
Jul 11, 2012, 8:17 AM
126 Posts
Re: Validate combination of 2 fields
There is a validator that just lets you type in javascript and return true / false so you can do what ever you like inside it.
 
<xp:inputText value="...."> 
     <xp:this.validators> 
          <xp:validateExpression message="validation failed"> 
               <xp:this.expression><![CDATA[#{javascript:
                    
                   if( < already exists > )
                   {
                        return false; // fails validation
                   } 
                   else 
                   { 
                        return true; // passes validation
                   } 
 
               }]]></xp:this.expression> 
          </xp:validateExpression> 
     </xp:this.validators> 
</xp:inputText> 
Oct 17, 2012, 1:23 AM
21 Posts
Re: Validate combination of 2 fields
 Thanks Simon... appreciate your help.

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