0
votes

I have an xPage that is behaving very oddly. (if xPages get corrupt, I think this one might be) Tell me what you think:

I have editable fields with onChange events that take the value of the field (a company name) and looks into the database to see if the company already exists. If it does not, a field called "isNew" is set to "y". BUT the next time a Full Update is performed, from another field or button, my "isNew" field (or all of them) are erased! Why on earth would a full update erase a totally different field?

Do I need to just recreate this xPage?

============================================================================ Ok, here's the onChange event on the editable field that sets the flag:

var c = currentDocument.getItemValueString("company");
var id = @DbLookup("","AD",tc,11); // this view column gets the doc ID
if (id==null || id==""){
 @SetField("isNew","y")
}

This field is being set properly - I use a computed field to display it. But the next full update (button, field, whatever) will erase the "isNew" field.

3
Can you please add the source of that page so everyone can see what you mean in detail?Oliver Busse
I second Oliver: provide your codestwissel
My guess is that you create a new document executing submit button. That's why the fields are empty. Have a look at your Notes document data source.Knut Herrmann

3 Answers

0
votes

I think your problem is caused by the data sources you have on your page and how you save them.

Maybe you have data sources that gets binded from the url that should not be.

Are you using data sources within a repeat or view panel? If so, make sure you are only saving the correct data source

0
votes

JSF (and thus XPages) works best when keeping MVC in mind. So you never manipulate a component, but keep that component bound to a model, like a data source or a scope. This way code doesn't get into each other's way. A refresh of a page computes the whole tree, not just the updated field, so you need to design your calls carefully.

0
votes

Work directly with your data source so do this instead of @SetField():

currentDocument.setValue("isNew", "y")