How to submit 2 forms with 1 single button?

Hi,

Here is the scenario:

I have 2 databases:
- 1 for survey with a table the store the answers to a survey
- 1 for lead requests with a table that stores the leads

The business case is that I'd like the visitor to fill in the survey AND fill the lead request on the same page.

I have "discovered" both tables with fabrik and fabrik generated the lists, forms, groups and elements nicely

I now have 2 fabrik forms that I can include anywhere in the site by inserting
{fabrik view=form id=1}{fabrik view=form id=2} in an article for instance.
This works well and the underlying DB tables are updating nicely
BUT I have 2 submit buttons:
- 1 for the "survey" form
- 1 for the "lead" form
So I have a situation where visitor can fill a survey form but not the lead form OR the lead form but not the survey form.

I'd like to avoid that and make sure that the visitore always fills BOTH the survey form and the lead form.

What I'm struggling to do is that I'd like to have only 1 "submit" button that will post the 2 forms to both tables (and both databases)

How can this be done?

Thanks
 
The only way to do that would be to join the two tables. I'm not sure which way you'd want to join them, but let;s say the "lead" is the "main" table ...

Create an element on the survey list called something like "lead_id", make it a field element, hidden, and set the format to be "Integer".

Edit the leads list, under Data, the "Joins" tab. Create a join from leads.id to survery.lead_id. NOT repeating. Save the list.

Your leads list/form will now have an extra group called something like "Leads - [survey]", which contains all the elements from the survey.

Remove the content plugin for the survey table.

When you add a new lead, it will now have a group with the survey in it, which will save as a related row in the survey table.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top