Multiple forms on the same page
See original GitHub issueDescription:
Hi,
I try to have multiples forms on the same page (one for each language). However, when I try to get data, it’s always the data from the last form.
Thanks.
Environment Details:
- formBuilder Version: 3.4.2
- Browser: Chrome 83
- OS: MacOS
Expected Behavior
Data of all forms
Actual Behavior
I get data of last form instead of data of each form.
Example
https://jsfiddle.net/fdehanne/1j9c8fry/14/
<button id="save">Save</button>
<div class="render"></div>
<div id="formEditor-fr_FR" data-culture="fr_FR" class="form-editor"></div>
<div id="formEditor-en_GB" data-culture="en_GB" class="form-editor"></div>
var formsBuilder = [];
$(function() {
$('.form-editor').each(function() {
var culture = $(this).attr('data-culture');
formsBuilder[culture] = $(this).formBuilder();
});
$(document).on('click', '#save', function() {
$('.render').html('');
for (var culture in formsBuilder)
{
$('.render').append(culture + '<br>');
var data = formsBuilder[culture].formData;
$('.render').append(data + '<br>');
}
});
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
How to place two forms on the same page? - Stack Overflow
You could make two forms with 2 different actions <form action="login.php" method="post"> <input type="text" name="user"> <input ...
Read more >Multiple forms on one page: bad practice? - Dev Talk
Hi there,. I received a design guide, where 3 different forms are placed on the same page. All of them have about 6–8...
Read more >can I add multiple form to one single html page - MSDN
Yes, an html page can have multiple forms. The forms cannot be nested though. ... Of course, it can contain many forms in...
Read more >Multiple forms on the same page - WordPress.org
I use multiple forms [shortcodes] on the same page. I have one in the footer loaded on every pages, and on one particular...
Read more >Include Multiple Forms on a Page - Intermediate Django
Include Multiple Different Forms on the Same Page · Step 1: Create the Forms · Step 2: Include the Forms in a View...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, here is the sample of my usage.
Initiate Multiple Instances
Get Data from All Instances on Submit
when I do this, I get
Cannot read property 'then' of undefined
. the first form id in#form1
gets rendered, but the second one never does. The way I solved this was to render like normal:Then later down the page:
Now the user data can be accessed like this:
form1responses = fbInstances['intake']['userData']
I hope this helps someone in the future.