[Catalyst] Re: CRUD, but with multiple tables involved
sdavis2 at mail.nih.gov
Mon Jan 9 12:24:49 CET 2006
On 1/8/06 6:39 PM, "Peter Edwards" <peterdragon at users.sourceforge.net>
> There are several ways of solving this. Your choice depends on whether you
> need a new breed record fully filled out before it is used, and whether you
> want to allow multiple windows.
> 1) Show a dropdown with all allowed breeds in it and an add button after it.
> it as a new entry to the dropdown with that as the text and NEW as the code.
> In the handler when a code of NEW is submitted create a new breed record in
> skeleton form, to be filled out later, and link the dog breed field to its
> 2) Show a DHTML combobox that uses AJAX to retrieve substring matches on the
> typed breed.
> - let them type in a new breed name and on submission create a new breed
> record in skeleton form (like 2 above)
> - show an "add" button after the combo which will open a new window to fully
> enter a new breed record, then either copy it back to the first window using
> the first window's combobox.
> You can pick up a free DHTML combobox or write one or consider a commercial
> one, e.g. http://developer.ebusiness-apps.com/
> 3) Wizard screens. Work out a flowchart of screens that will collect the
> requisite foreign key data and ask for them one screen at a time. So for
> screen 1 - pick dog breed from list (go to 3) or click add breed (go to 2)
> screen 2 - add new breed record (go to 3)
> screen 3 - enter dog name and basic details
> You can extend this with other steps for additional data.
> Regards, Peter
Thanks, Peter. Your insight helps. I may start with #3 and work up to #1/2
take me more time to develop at this point. However, sounds like it is
worth going there....
> -----Original Message-----
> From: catalyst-bounces at lists.rawmode.org
> [mailto:catalyst-bounces at lists.rawmode.org] On Behalf Of Thomas Hartman
> Sent: 07 January 2006 02:43
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] Re: CRUD, but with multiple tables involved
> Let's say the goal is to enter a dog with a breed.
> Seems to me what's really needed is a list-box. IE, a combination of
> drop-down (for breeds that have already been created) with the option
> of a textbox, for entering a new breed. Does something like this exist
> for html forms?
> If yes, and the user enters a new breed, you could also have a
> "verification" page where you say:
> 'entering this information will create a new breed "Shepherd." Are you
> sure you want to add this breed to the list of already existing
> breeds? Please double check that it doesn't already exist!' -
> followed by a list of existing breeds.
> I am having similar issues myself and so have been mulling this over.
> I am not sure if this combo listbox thing exists though. Would
> appreciate input on if this is a good/workable idea. And if it's
> workable if it can done with/without ajax.
> Don't really understand what the ajax functionality referred to
> earlier on was needed for. Explanation?
> 2006/1/6, Karl.Moens at marsh.com <Karl.Moens at marsh.com>:
>> Sean Davis wrote:
>>> Date: Fri, 06 Jan 2006 07:21:28 -0500
>>> From: Sean Davis <sdavis2 at mail.nih.gov>
>>> Subject: [Catalyst] CRUD, but with multiple tables involved
>>> To: The elegant MVC web framework <catalyst at lists.rawmode.org>
>>> Message-ID: <BFE3CAF8.323E%sdavis2 at mail.nih.gov>
>>> Content-Type: text/plain; charset="US-ASCII"
>>> This is not really a catalyst-specific question, but there is a lot of
>>> brain-power and experience lurking on this list, so I ask here. (Oh,
>>> mention, I am using Catalyst for developing this?)
>>> I have a table in the database "Dogs" that stores information like the
>>> date-of-birth, kennel club ID, registry name, etc. With each dog, I
>>> want to store the owner (stored in a contacts table), a breed (in the
>>> table), a sire and dam (these are references back into the "Dogs"
>>> In short, there are foreign keys that I need to account for. If all of
>>> these external objects (owner, breed, etc) already exist, they can be
>>> included in a dropdown list. However, if one doesn't exist, the story
>>> different and I need to allow users to create them. I can see multiple
>>> of doing this:
>>> 1) Make a set of "input" screens that force the user to choose all the
>>> "foreign objects" first and have the option on each page (breed, owner,
>>> parents) to create new entries as needed or to choose existing ones.
>>> Advantages: simple to create and can utilize the /list, /add, /edit
>>> functions for each of breed, owner, etc.
>>> 2) Make a single page that does everything in one shot. This would
>>> probably require either refreshes or AJAX calls to update dropdown lists
>>> would make "searching" breed, owner, etc. hard to do.
>>> 3) Make a single page that has links to "create new owner", "created
>>> breed", etc. This is probably what I envision being able to accomplish.
>>> Are the general hints or specific examples of this kind of application
>> I had a similar decision to make for my "Biblio" database. Users have to
>> enter the name of the book, author, publisher, owner, ... with separate
>> tables for all these attributes.
>> Rather than have the users go the counter-intuitive way of first having to
>> make the new entries before filling in the main form or the technically
>> more difficult way of using AJAX and its like, I opted for a single page
>> which the user fills in all basic data (e.g. name of the publisher), but
>> not (yet) the additional (and redundant) data, such as address of
>> publisher, ... . The application parses the form and checks if there
>> already entries in the various tables and if not returns to the user with
>> another form and request to fill in the full set of data required for
>> tables. The main problems with this system is that typing errors or
>> alternative spellings of key-fields will add "duplicate" records in your
>> tables and that one puts great trust in the users to indeed fill in the
>> additional form in order to keep all the tables nicely up-to-date. If the
>> link is broken or the user does not provide the info on the additional
>> form, the data in the table gets "corrupted". This can probably be avoided
>> by using transactions, rolling back the whole operation if not all data is
>> provided. The first problem is less easily solved (I haven't found a good
>> solution yet), but some automated (off-line?) checking of the records
>> (perhaps using a Soundex algo. or such) could flag duplicated or almost
>> duplicated entries for manual fine-tuning later.
>> aka CountZero at perlmonks.org
More information about the Catalyst