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 10, 2012, 3:07 PM
5 Posts
topic has been resolvedResolved

Update sessionScope variable from combobox

  • Category: Custom JSF code (Eclipse IDE)
  • Platform: All
  • Release: 8.5.3
  • Role: Developer,Administrator
  • Tags: sessionScope,Hide When
  • Replies: 2
  So, I want to hide a field and only show it when a particular value is selected from a comboBox.

Here is what I have:

afterPageLoad: create and set the variable to false
1. sessionScope.put("showSC", false);


For the field that is to show or hide, set the visibility to the sessionScope variable:
2. sessionScope.get("showSC");
This part works, the field is hidden. I can change the variable to true in line 1 above and it does show.

When a value ("Operations") is selected in the comboBox, use javascript to set the sessionScope variable:
3. onchange of comboBox
var cat1 = document1.getItemValue("Category1");
if(cat1 == "Operations")
{
sessionScope.put("showSC", true);
}
else
{
sessionScope.put("showSC", false);
}


The javascript above never evaluated to True. I can verify the document1.getItemValue("Category1") is pulling the value by setting that as the default value in a field.

I'm not sure what I am doing worng.

Any thoughts?
Jul 10, 2012, 5:09 PM
298 Posts
A few things to check
First, are you doing at least a partial refresh of the control that should be hidden or shown when the onchange event happens? That is needed. Next, add a print statement to see what value you are getting from your getItemValue. You might be better off using getComponent("comboboxlabel").getValue() instead since that is not dependent on when the value gets written to the Domino data source. Howard
Jul 10, 2012, 6:16 PM
5 Posts
Re: Update sessionScope variable from combobox
Got it! 
 
I was already doing a Full Update on change, planning on changing it to a panel/partial update later. 
 
I have not used the getComponent method before.  I tried it in line one of the onchange of the comboBox like so: 
 
var cat1 = getComponent("comboBox1").getValue()
if(cat1 == "Operations")
{
sessionScope.put("showSC", true);
}
else
{
sessionScope.put("showSC", false);
}
 

That fixed it.

Thanks Howard!

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