parent and child form

By: saleh ibrahem | Asked: 10/20/2024
ForumsCategory: How-toparent and child form
saleh ibrahem asked 3 weeks ago

"I want to create two related forms on the same page, where one is a main (parent) form and the other is a sub (child) form. The forms should be connected so that data from the parent form automatically links to the child form, and each form saves data in separate tables."

Form Fields:

  • In the main (parent) form, I have two fields:

    • ID1 (Unique identifier)
    • Name
  • In the sub (child) form, I have three fields (with a Repeater feature to allow multiple entries):

    • ID2 (Unique identifier for each sub-entry)
    • ID to 1 (This field automatically takes the value of ID1 from the parent form)
    • Task (Details about the specific task or entry)

Explanation:

  1. The ID to 1 field in the sub (child) form is linked to the ID1 field in the main (parent) form. This connection ensures that all sub (child) form entries are associated with the correct parent form entry.

  2. The Repeater feature in the sub (child) form allows the user to add multiple task entries, and each entry is saved as a separate record in a dedicated table for child entries.

  3. The data from the main (parent) form is saved in one table, while the data from the sub (child) form (including the multiple Repeater entries) is saved in a separate table, with each Repeater entry saved as an independent record.

1 Answers
Victor Font answered 3 weeks ago
Repeater fields are embedded (child) forms. Use a repeater to achieve your goal.

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