Bryan Schmiedeler Bryan Schmiedeler - 1 year ago 87
Javascript Question

Xpages: how to get a handle on a field using client-side JS, but without hard coding? [like this]

I am able to get an element and that element's value in CSJS by using the following.

var mystring = XSP.getElementById("#{id:myEditBoxID}").value;

I understand there are different ways you have to do this for some other element types like radio buttons, etc.

I do not want to hard code the field id, but would much prefer to use the equivalent of "this", but I don't see how.

I imagine if I do this in a custom control I could do it. It seems I should be able to climb up the DOM tree until I get the field?

Answer Source

Assuming you have a custom control with a property for the field id you can do the following:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download