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



Apr 20, 2011, 7:26 PM
31 Posts

Re: Cannot Get Field Value From Inside Function

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: client side JavaScript
  • Replies: 4
Have you tried using:
 
var employer = XSP.getElementById("#{id:computedField2}").value;
 
to get the value out of the variable?  I seem to have had to use something similar to the above to get at the value using CSJS.
 
 
Apr 20, 2011, 7:54 PM
10 Posts
Re: Cannot Get Field Value From Inside Function
Thanks for the thought Judy, but yep, I still get get XSP.getElementById....... is null.
 
I just saw this article about using dojo.query, but I can't seem to get that to work either http://rndnotes.wordpress.com/2011/03/03/105/
 
I did find that I can use var employer = document.getElementById("view:_id1:_id2:_id6:include1:employer_hidden_fields:computedField2").innerHTML; but I understand this is hard-coding a path that may change.  I'll have to do this if I can't get anything else to work, but there must be some way to get the system to dynamically provide the full path to the field.
 
 
 
 
Apr 20, 2011, 7:59 PM
31 Posts
Re: Cannot Get Field Value From Inside Function
To follow along your path, have you tried:
XSP.getElementById("#{id:computedField2}").innerHTML;  ?
Apr 20, 2011, 8:13 PM
10 Posts
Re: Cannot Get Field Value From Inside Function - GOT IT!!!
Yup, and I get the same results.  I have absolutely no idea why I couldn't use any of those configurations.
 
However, the good news is that with just a bit of tweaking, I was able to use the dojo.query to obtain the field value.  You use

var employer = dojo.query('[id$=\":EmployerID\"]')[0];
alert("employer:  " + employer.innerHTML);
 
I had used compositeData to bring the value of EmployerID from the custom control it was in, to the computedField2 on the current custom control.  However, with the above, I can directly access the data from the other custom control without using compositeData.  I had thought that was initially part of my problem - that the code couldn't 'see' the field because it was on another custom control and I understood that they can't see inside of each other.

Ya gotta love it when stuff works and in a more simple way than you were trying to do it!
 
Thanks so much for your help with this.  I do appreciate the suggestions.

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