Hello,
I am having some trouble with getting a <select multiple> HTML element
working. My application is a user manager where I want to dynamically
populate selection lists according to the rights of the currently logged
in user. I have successfully got past logging in and currently have my
"add a new user" empty form page coming up.
My template has a couple of select lists thus:
<tr>
<th align="left">User roles</th>
<td><!--V 'FORM:SELECT:roles'-->size="6" multiple<!--/V--></td>
</tr>
<!--V 'ERRORS:roles'/-->
<tr>
<th align="left">Admin area</th>
<td><!--V 'FORM:SELECT:admin_area_ref'/--></td>
</tr>
<!--V 'ERRORS:admin_area_ref'/-->
The second of these comes up perfectly populated from a database table
with values and captions as expected. The multiple one comes up as an
empty single-value dropdown list. It appears the "multiple size=6"
attributes aren't being noticed.
I'm populating the two lists via resource bundles in my AddUser.java
implementation class thus:
/* Populate select list for admin areas */
template.addResourceBundle(
new ListResourceBundle() {
public Object[][] getContents() {
AdminAreaManager aaMgr = new AdminAreaManager();
return( aaMgr.getAdminAreasResourceBundle() );
}
} );
/* Populate select list for user roles */
template.addResourceBundle(
new ListResourceBundle() {
public Object[][] getContents() {
RoleManager rlMgr = new RoleManager();
return( rlMgr.getRolesResourceBundle() );
}
} );
The first of these works perfectly. The second doesn't seem to work
with anything despite an Object[][] correctly populated coming back from
getRolesResourceBundle(). If I change the FORM:SELECT:roles to the
raw HTML I do at least get a multiple select list rendered, though still
without content. The constraints I am applying in the submission bean
(which of course isn't present for an initial add user where no
submission has happened) are:
addConstraint( new ConstrainedProperty( "admin_area_ref" ).notNull( true
).notEmpty( true ).inList( adminAreas ) );
addRule( new RolesValidationRule( "roles" ) );
The rule simply has a validate() method which checks the bean property
value (assumed a String array - see below) against the roles table.
What am I doing wrong here?
A subsidiary question - for HTML elements like a multiple select list, I
assume the parameter eventually passed to me is mapped onto a Java
String array? So that the getRoles() and setRoles() methods in the
submission bean should be working with String arrays?
Thanks,
David Herbert.
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users