One of the most irritating issues that I encountered while working with XPages, especially when enhancing an existing Lotus Notes application is 'getComponent()' is null error.
My suggestion here will be silly, but I honeslty feel that there will be people out there who will acknowledge its severity
when a code fragement say, getComponent("fieldName").getValue() returns this error,
1.Check if a component with if "fieldName" actually exists
and
2. Note that "FieldName" is different from "fieldName" - cross check with the cases in the component name and the one mentioned in your code
Thanks and Regards,
Karthick
All controls (textbox, button, etc.) must be in the same XPage or in the same custom control.
ReplyDeleteregards
I am getting a similar error when I try to set the value binding of a particular filed dynamically like: getComponent("'" + fieldName + "'").setValueBinding('value', valueBinding); Can anyone help on this?
ReplyDeleteOk may be I sound wierd, give this one a shot. It seems like you have a variable named as "fieldName".
ReplyDeleteIf so,why can't you use
getComponent(fieldName).setValueBinding('value', valueBinding);
instead of getComponent("'" + fieldName + "'").setValueBinding('value', valueBinding);
Well dont get mad at me if this is a no brainer. Just a guess :P