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 updateMode property specifies how changes to a property value affect existing data. You can set updateMode to one of these values:

Note: If updateMode is set to append or prepend, you must also set the numNewValues attribute.

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:

updateModevalue

Userinput

Resultingpropertyvalue

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, to indicate the number of items to add.

For example, the following code specifies to add a single 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"/>
 
loading table of contents...