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



Sep 11, 2013, 2:26 PM
17 Posts

Validate Edit Box only if a Checkbox is not checked

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role:
  • Tags:
  • Replies: 0

I only want to require a field if the user has not checked a check box elsewhere on the form.

 

The checkbox's value is "Yes" if checked or "No" if not checked.

 

On the Edit Box's validation formula I have the computed SSJS:

getComponentValue("SoleSource") == "No"

 

the function is stored in as a JS source

function getComponentValue(id){
  var field = getComponent(id);
  var value = field.getSubmittedValue();
  if( null == value ){
         // else not yet submitted
         value = field.getValue();
  }
 
  return value
}

 

No matter if the checkbox (with the ID "SoleSource") is checked or not, it always returns "No", which is the default value, and attempts to validate my field.

Is there any way to do this without submitting the form first?


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