When a RepositoryFormHandler uses a value dictionary, it adds the sub-property repositoryId to all multi-valued properties. This property references other items and their property values so you can update a collection of items using their IDs.

A form might use a RepositoryFormHandler to update user information, such as access controls provided through user roles and organizational groups. For example, you might want to enable an administration user to edit a user profile roles property, which holds a set of ID objects that reference role items. Each user profile has a property called currentOrganization, which maintains the sub-property relativeRoles. Because a user can have more than one role, relativeRoles is a set of role ID objects that designate user responsibilities and access requirements.

This form is designed to add the current organization to a user’s profile so the user acquires some of the roles associated with that organization. The form performs these tasks:

In order to implement this form, a ForEach servlet bean iterates through the currentOrganization relativeRoles property and presents each role ID it finds as a name in the form page, through a selection box:

<dsp:select bean="MyRepositoryFormHandler.value.roles.repositoryIds">
   <dsp:droplet name="ForEach">
      <dsp:param name="array" bean="Profile.currentOrganization.relativeRoles"/>
      <dsp:oparam name="output">
         <dsp:option param="element.repositoryId">
            <dsp:valueof param="element.name">unnamed role</dsp:valueof>
      </dsp:oparam>
  </dsp:droplet>
</dsp:select>

In this example, a dsp:option tag is generated for each role in the relativeRoles property. The option value is the ID of the role repository item.

The form user selects several roles; on form submission, the MyRepositoryFormHandler.values.roles.repositoryIds contains the list of repositoryIds checked by the user. These are used to update the user’s roles property.