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



Nov 10, 2015, 11:11 AM
24 Posts

Hiding Various Fields-on selection Check box

  • Category: Server Side JavaScript
  • Platform: All
  • Release: All
  • Role: Developer
  • Tags:
  • Replies: 3

Hi Few days Back I got a Required to Disable a validation check on a combo box depending on a check box selection. I put the following in Disablevalidators of the combox

var status = getComponent('d_checkbox').getValue();

if (!status || status !== '0') {return true;} return false

means if the check box is not selected the field validator will work, if it is checked the field validator will be disable. It worked fine.

Now I have another requirement to hide the fields, combo box, labels etc on the same condition as above

I tried to put the Same in Visible Computed, it not hiding the fields when check box is enabled. 

var status = getComponent('d_checkbox').getValue();

if (!status || status !== '0') {return true;} return false

I am new in Xpages, I am learning and doing modifications, Can some one please help me how should I get this

 

Thanks

 

 

Nov 11, 2015, 12:33 PM
586 Posts
hmmm

Not sure I have a great answer.  I almost never use "getComponent" and do more of my validation in the save events.

 

if (!status || status !== '0'

 

I've never seen the "!==" before.  What does that do?  I would have thought you'd want "!="

Ideally if you could bind that checkbox to a viewScope variable then you could more easily see the value at any given time and have the visible/rendering of the things you want to hide read in the viewScope variable.

return viewScope.get("myVar");

 

Just a thought

 

Nov 16, 2015, 10:37 AM
24 Posts
Hiding Various Fields-on selection Check box

!== means not equal to

 

I also tried using

 

 

var _key1 = viewScope.get("iDraft") || @GetField("iDraft");

 

if(_key1 == "0"|| _key1 == "[0]" ){

true

}else {

false

};

 

but it's not hiding the field, any other logic to hide the field if check box in enabled

Nov 16, 2015, 10:37 AM
24 Posts
Hiding Various Fields-on selection Check box

!== means not equal to

 

I also tried using

 

 

var _key1 = viewScope.get("iDraft") || @GetField("iDraft");

 

if(_key1 == "0"|| _key1 == "[0]" ){

true

}else {

false

};

 

but it's not hiding the field, any other logic to hide the field if check box in enabled


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