> Anyone got a workaround or a fix for this? Happy to have a go at it
> myself but I've spent a couple of days scratching my head over this
> and haven't really gotten anywhere yet so could do with some pointers,
> thanks!
If you create a formatter (see play.data.format.Formatters) for your lookup model type (in your case, for your "Client" model), you can refer to the field name directly in your select helper, instead of referencing it by its id. This bypasses the need to solve the apparent problem.
example:
public class Client extends DoctuaAuditingModel {
static {
play.data.format.Formatters.register(Client.class, new ClientFormatter());
}
public static class ClientFormatter extends SimpleFormatter<Client> {
@Override
public Client parse(String text, Locale locale) {
if (text == null || text.trim().length() == 0)
return null;
return Client.find.byId(Long.parseLong(text.trim()));
}
@Override
public String print(Client value, Locale locale) {
return (value == null || value.id == null ? "" : value.toString());
}
}
@Id
public Long id;
...
}
Then in your select helper you'd simply reference it like this:
@select(filledForm("client"), options = ...)