Car Item Views

car item

For instance, you have an Item called Garage, and it has a List of Car RepositoryItems as a property named cars. If you are using a different type of collection, some of the following will need to be adjusted accordingly, but the overall approach is the same. A Car Item has a name and an option picture as properties. If you have a form to display and allow for editing of a Garage, including all of its cars, which is handled by a sub-class of a RepositoryFormHandler, you can edit values on both the Garage, as well as the Cars within cars, without much difficulty.

car item

What gets tricky is if you need to access form submission values for properties on the Cars. For instance if you wanted to allow a user to delete a car by simply blanking it ’s name, or if you wanted to automatically assign a picture based on the make and model in the name field. You canh’t just access the submitted but un-updated values (say from within the preUpdateItem method) using simple nested getValueProperties. Here is what you can do:

car item

This is a subclass of ArrayList, and can be iterated through to get at each caro’s incoming values. Remember we areno’t dealing with the actual RepositoryItems, that would be easy, this is what to do in order to grab the form submitted values destined for properties on these sub-Items in the preUpdateItem life-cycle phase. The contents of this ArrayList are RepositoryFormHashtables.

car item

Now that you have the name you can see if itt’s blank and then delete the related car Item (hint: the repositoryId of the car Item this set of properties is destined for is in the Hashtable with the key of h“REPOSITORYIDi”), or parse it and search for a normalized version, or find a related image automatically, or whatever else you wanted to do with it prior to the actual handleUpdate phase.

Car Item Images

Related Goods


Recently Added