Hey all,

I'm working on some code (it's actually within one of my classes right now),
that I think would be a good addition to turbine.  It's a way of
automatically updating the fields in a peer class based on the fields in a
submitted form.  For example, if you have a contact object, and the fields
are:

firstName
lastName
address1
address2
city
state
zip

You can set up a wm template with a form that has <input type="text"
name="firstName">...etc.
Then in the action you can do:

ParameterParser pp = data.getParameters();
myContact.updateFields(pp);

And it will automatically set all of the member variables in the Contact
object which are in the parameter parser.

Furthermore, if you have more than one contact displayed on a form, you can
append the contactID to the name of each form element, for example:

<input type="text" name="firstName$contact.ContactId">

And the code above will know to automatically take the form fields with the
correct ID.
For fields which end in a number (like Address1) you can prepend the
contactId to the name of the form element.

Does this sound like something I should generalize, and we can put it into
turbine?
I think it would go well in the autogenerated peer code, or as a base class
which those would extend...

        -Nissim


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to