Dynamic Combo Box Bug? Validation Error: Value is not valid

I have two combo boxes on an xPage, category and subcategory. Both are based on lookups, with the subcategory using the category as the key. This all works fine, and I can get the subcategory to dynamically change using the onChange event of the category, with the ‘do not validate…’ option turned on.

The problem is when I try to save the xPage (using a button that does ‘full update’). If the chosen subcategory was not part of the original choices when the page was first rendered, it won’t save, giving me the error:

Validation error: value is not valid

The stack trace says:

Java.util.nosuchelement

This seems to be a common issue on the JSF forums, but I haven’t found an xPage specific solution.

I do have a workaround: I add a default category called “please choose a category”, and then hide the subcategory item when that is the chosen category, ie when the page is first opened. The subcategory field then returns ALL subcategories as its choices when the category is ‘please choose a category’. No one sees the full list, because the field isn’t rendered at that point, but once the list is filtered and rendered, there doesn’t seem to be any problems saving.

Is there a better fix, or am I missing something simple?

Thanks,

Karl

Subject: Spoke too soon…

I spotted the flaw in my plan: if fields aren’t rendered when the page is first loaded, they do not appear to be saved! My resulting Notes document only as the category value, not the subcategory value, unless I render the subcategory at all times, in which case I can’t have dynamic values! I must be doing something wrong.

Karl

Subject: Find a solution

Did you ever find a solution to this problem. I am running into the same thing. Thanks.

Subject: try this…

in your save button, mark the checkbox process data without validation

hope this help

Subject: Space around values

In my case it was spaces around the values that feed the listbox. That was simply fixed doing trim() in the source data.