"Joined" Forms - Foreign Keys

By: Rudi JvR | Asked: 03/22/2023
ForumsCategory: General questions"Joined" Forms - Foreign Keys
Rudi JvR asked 1 year ago
Hi there, I'm in need of some guidance to pull, and join form values from different forms.  It a database sense this is done using primary and foreign keys. Scenario: Table/form 1: Master inventory table Table/form 2: To captures details associated with Table 1, the details are captured at different intervals (many entries) So Table 1 is unique and Table 2 has many entries associated with Table 1 (1 to many relationship)   So my Question is: How do I store the Entity_ID from Table 1 (primary key) in the Entries for Table 2 (foreign key)?
  • How do I set up the Form for Table 2 to submit entries WITH the Entity_ID from Table 1?
  • How to I retrieve (i.e. in a FF View or "joint Table/Form") the details of Table 1  & Table 2 using FF?
  I will really appreciate any help to get me over this hurdle, as this functionality will be used throughout my website.   Thanks Rudi  
2 Answers
Best Answer
Victor Font answered 1 year ago

First, forget the idea of tables, primary, and foreign keys. Both WordPress and Formidable use a metadata design. All formidable entries are stored in two tables, wp_frm_items and wp_frm_item_metas. wp_frm_items is an entry header and wp_frm_item_metas stores each field from an entry as a separate table row. Here's a link to the database schema: https://formidableforms.com/knowledgebase/database-schema/. If you want to add an entri_id from Form A to link it with form B, just add it as a hidden field on Form B and make sure you pass the entry_id from Form A as a parameter to populate the field. Use the [get param] shortcode to populate the field.

Rudi JvR replied 1 year ago

Thanks Victor - This insight is very helpful and will hopefully help steer my design in the right direction.

I'm new to both WordPress and Formidable Forms and had a feeling there was a "language" breakdown in terms of the design principles, and that is exactly where I was stumbling.

Thanks again!

Rudi JvR answered 1 year ago

Hi Victor,   

I feel like I'm so close to cracking the solution I'm developing, but have difficulty passing and storing Entry ID's between forms.  I really hope you can give me some guidance to get past this hurdle.   

I created a custom Search form on my User Inventory table (unique inventory entries) which returns results to a View. 

I added an Edit Link for each returned row which links to a different form where I intend capturing Detail related to the selected Entry from the search result (many Detail posts are possible for a single Inventory entry). 

I want to pull the Entry ID of the selected row (Edit Link) to the Details capture form.  For the life of me I can't seem to find the way of parameterizing the Inventory Entry_ID so that I can reference and save it in the Details form!?   
Link config on View:
[editlink label="Capture Detail" page_id=1338 title="Capture Detail" ]  
On my Details capture form I added a field to store the "InventoryEntryID" and tried adding the following as the Default Value:
[get param=InventoryEntryID] 
How do I get the Entry_ID of the Unique Inventory Entry?  

I really appreciate your assistance.  

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right