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