RE: Simple Web forms to create an EO object
RE: Simple Web forms to create an EO object
- Subject: RE: Simple Web forms to create an EO object
- From: <email@hidden>
- Date: Thu, 5 Aug 2004 11:53:21 +0200
- Thread-topic: Simple Web forms to create an EO object
> 3. Other.
In situations where you want to develop something more generic and robust you might want to go with both the EO and multiple dictionaries:
- One dictionary to contain the values in the client form. I.e. string representations of both your EO's attributes and its related objects. The form is bound to this dictionary.
- A copy of the above dictionary as it was during appendToResponse
- A dictionary of formatters used to convert between EO values and what you have in the above dictionaries
- A dictionary of fetch specifications allowing to retrieve objects for your EO's relationships based on string values submitted by the user
You would thus, on first display, create the values dictionary from your EO using key-value coding and formatters as well as the list of key-paths you want to expose. Shortly before sending the values to the client, the backup dictionary would be created.
Upon submit, you would compare the dictionary bound to and modified by the form to the backup copy. Only for changed values you would:
- parse the new value using the appropriate formatter
- build an EO from the value using the fetch specification if provided
- validate the value using your main object's validateKey methods
- provided it is acceptable, set the value on the EO using key-value coding
This may be quite some extra overhead but it buy a lot of flexibility and robustness.
Pierre
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.