XPage combobox and client-side script question

I’m trying to do some scripting with combo and an edit box controls on an XPage. Just to know where I am I started with putting some alerts into client-side events:

combo-box: onChange-event:

alert(this.options[this.selectedIndex].value);

result: no alert box, but no error either.

edit-box: onKeyUp-event:

alert(this.value);

result: alert returning “undefined”.

I also tried other options:

this.name ==> results in an empty alert

this.type ==> “undefined”

this.length ==> always returns “1”

Looking at the source using Fierbug I see that there’s no event-script tied to neither of the elements.

At the bottom of the source code however, I see 2 JS functions that appear to be corresponding to my client-side scripts. Both are carrying the arguments “thisObj” and “thisEvent”.

But changing “this” to “thisObj” in my scripts doesn’t help either.

Next attempt: using various methods I retrieved the true name of my combo-box select object (“view:_id1:Categories1”). As this appears to be a rather strange name I really didn’t expect that I could use it tp work my way around the “this” keyword, and in fact it didn’t work: the alert simply isn’t executed.

The only thing that works in accessing the combo’s selected value is using something like

document.forms[0].elements[6].options[document.forms[0].elements[6].selecetdIndex].value;

Not really my choice of coding; somehow I feel that I’m thinking to complicated, that accessing the wanted value is much much much easier here.

so the question is: what’s the proper way to access my field values on an XPage while they aren’t saved yet?

Subject: Try XSP.getElementById

If you know what the name of the control is, ‘inputText1’ for a editbox on the XPage in Designer, then you could use #{id:inputText1} to get the client id.

e.g.

var input = XSP.getElementById(“#{id:inputText1}”);

alert("Subject field = "+input.value);

Subject: … or try …

ok, sounds good, thanks for the suggestion; meanwhile I also had success with

docObj.getItemValueString(“itemName”)

where “docObj” is the named datasource supplying the item.