PDA

View Full Version : Help needed with foreign keys



kenITR
16 Aug 2007, 6:27 AM
I'm just getting started with Ext, but I continually have problems handling database keys. This time it's foreign keys.

I am using the handleAccountAction.js from the tutorials as my guide to building forms for adding new rows to the database. In this case, I am adding a row to a grid that is a child table of the main form on the page. The main form has a primary key embedded in a hard coded div in the html because I can't get it into the js form itself as a hidden field; but, that's another issue, I think. This primary key is the foreign key of the grid rows. When I submit the cell of any row for update, I use the primary key of the child table which I can keep as a hidden field in the grid, so that's not an issue, but, and here's the problem, when I want to create a new row in the child table I need the primary key from the main form to submit along with the new data to create the new row in the child table in the database.

Given the construction of the input forms in handleAccountAction.js (they're heavily object oriented) I cannot get the dynamically generated primary key id from the document (different main form data comes up when different nodes on a tree are clicked).

Does the way handleAccountAction.js creates these input forms preclude me from doing what I want? Do I have to take a different approach? Is there a way to do this?

Any help would be greatly appreciated. Others must run into this problem, too?

Thanks,

Ken

kenITR
16 Aug 2007, 8:22 AM
I was able to solve this by putting params in the submit function of the form's add button.

I didn't know you could do that. I hope this helps someone.

Ken