On 30/05/2012, at 10:06 AM, Ramsey Gurley wrote:
It shouldn't have made it to the dataSource() method. You should log what rules are firing for restrictedChoiceKey. Open your log4j page and set up a d2w rule logger for that key. See what the console tells you when you load the page.
Ah, OK, this is subtle. As I mentioned, this is an attribute I'm adding to the model at runtime (Organisation.billingStatus). As such, the Organisation class knows nothing about it, and I don't get the opportunity to set a default value. So when the page calls object.billingStatus.allValues to get the values for the drop-down, it gets a null at billingStatus. Adding this third line works:
EditPageInterface epi = D2W.factory().editPageForNewObjectWithEntityNamed(Organisation.ENTITY_NAME, session());
epi.setNextPage(session().context().page());
((ERMODWizardCreationPage) epi).object().takeValueForKey(BillingStatus.Billed, "billingStatus");
But obviously that's going to be brittle—casting the EditPageInterface to an ERMODWizardCreationPage. (I don't see myself changing looks any time soon, so it will work indefinitely, but it's still ugly.) Got any better ideas?