Friday, February 12, 2010

document.getElementById in XPages

 After I created my first XPage, I added a Button and a Edit Box from the control palette to the page. Now I have mentioned the name of the field as "myField".

And in the onclick event of the button, I had put the following code on the Client side javascript

var fieldVal=document.getElementById("myField").value;

When I clicked the button on Notes Client it said "Undefined"

So the fix to this issue is as follows,

var fieldVal=document.getElementById("#{id:myField}").value;

And that worked fine alerting my values that i put in the edit box.
I assume that the JSF process (probably) on the back end, puts my field id as  #{id:fieldName} format .

No comments:

Post a Comment