Hi Jeremy,
from a quick look, it seems that you're missing something that
provides the list of valid values of the select box. You only
generate the localization labels for those values, but don't generate
an inList constraint for them. If you've obtained them from the
database, you can do this as so (assuming you've got a
ConstrainedProperty setup for accountTypeId, otherwise just add a new
one):
account.getConstrainedProperty("accountTypeId").inList(yourvalues);
Hope this helps,
Geert
On 05 Apr 2007, at 18:33, Jeremy Cowgar wrote:
I am having troubles making this work. It seems that my resource
bundle's getObjects method is never being called. This is the
relevant portions of my code...
AccountTypeService.java
public ListResourceBundle getResourceBundle() {
final Select select = new
Select(getDatasource()).from(TABLE_NAME)
.orderBy("name");
return new ListResourceBundle() {
public Object[][] getContents() {
List<AccountType> objs =
executeFetchAllBeans(select,
AccountType.class);
ListIterator<AccountType> it =
objs.listIterator();
Object[][] results = new Object[objs.size()][2];
System.out.println("Getting account types: " +
objs.size());
int idx = 0;
while (it.hasNext()) {
AccountType at = it.next();
System.out.println("Type: " +
at.getName());
results[idx] = new Object[] {
"accountTypeId:" +
at.getId(), at.getName() };
idx += 1;
}
return results;
}
};
}
AccountEdit.java:
public void processElement() {
final Template t = getHtmlTemplate("account.edit");
if (hasSubmission()) {
// Save account
} else {
account = new AccountService().get(accountId);
}
t.addResourceBundle(new
AccountTypeService().getResourceBundle());
generateForm(t, account);
print(t);
}
account/edit.html:
<td><r:v name="FORM:SELECT:accountTypeId"></r:v></td>
Any thoughts?
Thanks,
Jeremy
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users