Thanks for the detailed report, Adam. I'll try and reply with the detail it deserves.

Adam Mackler wrote on 1/12/10 8:05 PM:


So, now firing up the app that was magically created for me, I have a
pulldown menu with the name of app on it.  On this menu I have items
for Debtor and Name.  I see an option to create a Debtor, and I get a
blank form.  In the HTML source of the form, searching for "name='id'"
finds nothing.  So far so good.

Now I see that the current_name field has a text field for me to enter
the value of the id column of this debtor's row in the names table.
What I want to do is to replace this with three text fields for first,
middle, and last names.  I think the way to do this is with nested
forms.

You could go down that road, if you wanted to, and certainly RHTMLO supports it (as you discovered). But the RDGC controllers would require some more drastic surgery than what you probably want to attempt.

Instead, I think you want to use the existing features in RDGC to first create a Name and then relate a Debtor to it. That is a little backwards from how you would think of it as a user, but RDGC is a "bare-metal" db app. That is, it tries to give you a one-to-one reflection of how the db is organized, and if your db is highly normalized (which is a good thing, depending on how you are using it) then the resulting web UI can feel a little "cart before the horse".

So, in the UI presented to you, if you select Bigk from the menu, then Name -> Create, and create a Name record first, you're on the right track. After you save the Name record, you should see the Related menu on the left, and the option for Debtors. Click Debtors, and then "Create new Debtors" on the right. Enter and save the new Debtor record and you're nearly there. Since you've got a one-to-one going both directions in your schema, you'll want to enter the FK in the 'debtor' column for the original Name record you entered. Then you should be able to click back and forth between the Name and Debtor record you've created, since the FK columns should have a href generated next to each value.

Rather than viewing FK ints all the time, what I tend to do is create a unique, human-friendly column in each table, or add a method called 'unique_value' in my RDBO subclass that returns a human-friendly value. The 'unique_value' method is called if available.

Hope that helps. Feel free to ask more questions if it doesn't, and consider adding a write-up of your experience to the Catalyst wiki to help the next folks who stumble along this path. Oh, and doc patches also welcome.

--
Peter Karman  .  http://peknet.com/  .  pe...@peknet.com

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to