By default, the RepositoryFormHandler updates a property value by overwriting its old value with the new one. In the case of multi-valued properties, you can modulate this behavior in the following ways:

Note: These property options are available only if the extractDefaultValuesFromItem property is set to true.

updateMode

The form handler property updateMode specifies how changes to a property value affect existing data. You can set updateMode to one of these values:

For example, the list property hobbies has the following string values:

Mountain Biking
Running
Canoeing

The form contains a hidden input tag that sets the update mode for the hobbies property with the following format:

<dsp:input type="hidden"
   bean="myHandler.value.hobbies.updateMode" value="update-mode"/>

The following table shows the various values for update-mode and how various input scenarios set the property’s value:

updateMode value

User input

Resulting property value

append

Rafting
Swimming

Mountain Biking
Running
Canoeing
Rafting
Swimming

prepend

Rafting
Swimming

Rafting
Swimming
Mountain Biking
Running
Canoeing

replace

Rafting
Swimming

Rafting
Swimming

remove

Mountain Biking
Canoeing

Running

numNewValues

If updateMode is set to prepend or append, you must also set numNewValues to a positive integer. By default, it is set to 0. The following code example specifies to append a gift list to the list property giftlists:

Enter Gift list:
<dsp:input type="text" bean="MyRepositoryFormHandler.value.giftlists"/>
<dsp:input type="hidden"
  bean="MyRepositoryFormHandler.value.giftlists.updateMode" value="append"/>
<dsp:input type="hidden"
  bean="MyRepositoryFormHandler.value.giftlists.numNewValues" value="1"/>

Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices