I have an xpage with a custom control on it containing a panel and within that panel, there are 6 fields. The first field, the user name, contains SSJS for the default value to put the current user name in there. The other fields all contain SSJS in their default values to do a lookup based on the name field and pull back other info like phone number, manager name etc.
I have added some SSJS to the onBlur event of the name field so that you can change the name in the field and the same lookups on the default values for the other fields run and they get their values updated to match the name in the username field. This works fine on a document that has been saved, but on new documents it’s as if the onBlur event doesn’t fire. I have tried hard coding a teext value to be assigned to one of the fields but this doesn’t happen, and neither does the lookups that I have written.
Below is the code that runs in the onBlur event for the Name field - can anyone tell me why this doesn’t run on a new document, yet the default value property for each of the fields all work when a new document is created:
var lukey=getComponent(“Name”).getValue();
var TelVal= @Subset(@DbLookup(@DbName(),“ZLAI-875HPQ”,lukey,4),-1);
if (TelVal!=undefined && TelVal!=null) {
getComponent("Tel_No").setValue(TelVal);
}
var mob = @DbLookup(@DbName(),“ZLAI-875HPQ”,lukey,5);
if (mob!=undefined && mob!=null) {
mob = @Subset(mob,-1);
getComponent("Mob_no").setValue(mob);
}
and the default value for the Mob_no field as above is this, which works fine on new documents:
var lukey=getComponent(“Name”).getValue();
var mlist= @DbLookup(@DbName(),“ZLAI-875HPQ”,lukey,5);
var mob = @Subset(mlist,-1);
return mob
Thanks in advance