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



Jun 14, 2012, 4:33 AM
32 Posts
topic has been resolvedResolved

Get current field value when executing script

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: development
  • Replies: 3
Hi,
 
This might e basic, but I don't know the answer!
 
I have a combobox, executing some SSJS when the value changes.
 
I need to set some field vales depending on the value of the combo box.  How do I get a handle on the value of the combobox?
 
I have tried getComponent however am not getting any values, and I assume because the script is executing before the value has been set?
 
Any thoughts?
 
Jun 14, 2012, 5:30 AM
17 Posts
Re: Get current field value when executing script
In the onchange event for the combobox
set "Do no validate or update data", this results in immediate="true",
then use getComponent("comboBox1").getSubmittedValue() to get the value of comboBox1
 
this gives you code for the eventhandler of the onchange event for the combobox like
 
<xp:eventHandler event="onchange" submit="true"
                                    refreshMode="partial" immediate="true" refreshId="xxx"
                                    id="eventHandler1">
      <xp:this.action>
                                <![CDATA[#{javascript:viewScope.rksoort = getComponent("comboBox1").getSubmittedValue();
                                sessionScope.soort=viewScope.rksoort;}]]>
      </xp:this.action>
</xp:eventHandler>
Jun 14, 2012, 6:52 AM
32 Posts
Re: Get current field value when executing script
Thanks Walker.  That helped heaps.
 
Cheers,
 
Jun 14, 2012, 7:16 AM
129 Posts
Re: Get current field value when executing script
To avoid hard coding the id of the current component, you can use this:
this.getParent().getSubmittedValue() 
 
This in the scope of the event is the event handler. The parent is the component. 

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