How to add a record of a child table in a popup form, linked from a data table component

I had at last a nice idea how to add a child table record when you are in a table and the child table is connected through a connection to the parent table. This problem has kept me occupied for a long time.

The problem is that you have to have a connection to the parent table so that the added record in the child table is connected. This will not happen if you add the button for link page, it will lose the link to the current record in the parent page.

The solution is that you add a details page to the table component, it will be automatically created by Tadabase. Then you delete the details component in the details page and add the form component. You are asked by Tadabase to chose the data table the form is connected to. You chose the option that the child table data table is connected to the parent table.

In my case I have an applicants table and an interviews table as child table. This is a many to one connection as you have more than 1 interviews for an applicant.
I have a table of applicants, and added a button in this table to add an interview. It calls the details page with the form for the interview, and if I save it, it will be automatically connected to the applicant.

I struggled with this for a long time, and I hope this helps for others how to handle this. Or someone tells me there is better way to do this.

It now looks like this:
image
There are 6 buttons here:

  1. a details link (with the child record form) “add interview”, as a popup
  2. an action link to move the record to the next stage of the recruitment process
  3. an action link to reject a candidate (it will set the recruitment stage to reject)
  4. an action link to set the candidate to “backup” (it will set the recruitment stage to backup)
  5. a connected page link, which links to a details page not depending on this page but depending on another page
  6. an edit component, in which you can change data for this applicant in a popup page.
2 Likes

Hi Peter, thanks for sharing this. I think I understand the issue you are highlighting. The issue of losing parent ID when you add new child record inside related child table had me puzzled for long time. The type of table relationship ( connection ) makes a big difference ( one to many or many to one or many to many) but that is a long story. For the issue you highlighted - i found this happens when the parent record edit form is set to ‘pop-up’ mode and a child table is embedded inside same edit form and if you try and add new child record then this is when the parent id is lost. I think this happens becuase of pop-up on top of pop-up form makes the linkage fail. The way i got round this problem was by doing what you did, however I found by setting the edit form to open in a new window rather than pop-up keeps the parent id linkage. Let me know if we are on the same frequency or if I am talking about something unrelated.

1 Like

I struggled with this for a long time as well, but was able to solve it with the new “browser local storage” feature.

I just save a couple of Record IDs to local storage using tb-render and then use a record rule to populate them in the form upon submit.

1 Like