When I have multiple forms on one page with boltforms the submission sent twice. It are two the same forms one in a modal and one in the footer. How fix this? And if I made two different forms woulds that resolve the issue?
The form submission is handled by the boltforms system based on the name of the form - if you have two forms on the same page both forms will be triggered, and if the name of those forms is the same, both forms will continue with the submission.
If you make two forms that have different names, only one of the forms will continue, so that would fix your problem.
Related
I have to create a large form that will at the submit at the end.
However since this form is large, it is split into smaller steps. Each step is displayed on the same page but only accessible in order (so first have to complete step 1 before being able to open step 2 etc).
Therefore I need to validate the inputs for each section before giving access to the next.
1.Should I break apart the form (so create 5 forms that each get validated on submit and then have a final button that checks them all and sends them off to backend)
Or
2. can I keep it as one large form and is there a way to only validate certain parts of the form? From what I understand nesting forms is not possible
(I am using jquery)
As you said, the steps are merely a UX improvement to a long form. So stick to one form tag and validate the inputs either on blur / input for each field or when your user is about to move from one step to the next.
You could maintain a small object with the state of each step and upon submit validate that each step is marked as "validated" before sending your request to the backend.
Alternatively, as forms can be tedious to validate properly, have a look at the many libraries out there that could help you in the process.
I want to display a list of contact addresses.
Each contact has information such as name, street, city, country, phone, email, website, ...
There are several hundred addresses I have to display.
A contact has to be editable on demand. That is if the user clicks an "edit" button on the side.
Now here is my issue: Is it appropriate to have several hundred forms on page which I activate with the click on the button?
Or is it better to display the data in a <div>, <p> layout and have something like a modal with the form popup?
Does it cause problems to have so many forms?
Having so many forms will cause the webpage to become bulky and slow, and it will be a hassle to maintain. In order to avoid having hundreds of forms on one page, you can have a single form which is dynamically edited according to which contact address the user selects.
There is no problem. MDN approves of multiple forms in one page.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
I have multiple submit buttons in a form. How do I send all the information from the form to a MySQL backend just once? I know how to do it with just one submit button.
Additional information is that I have multiple submits to create a multiple step form and I want to go ahead with the multiple submit solution.
You would need to have multiple forms if creating this without using Javascript
How can I do this? Doesn't a form only have one action? What if I have 3 different buttons at the end of a form and each one invokes a different script? Much appreciated.
Something like this is possible, but not in pure html. You need javascript for that, because a html forms action is defined in the form tag, which accepts only a single action.
Using javascript however you can register differrent handlers for the click events of different submit buttons, thus send the forms data to different locations.
I have a HTML form which allows a radio button selection of two products. After the product is selected, the user has the option of digital download or delivery of which there is a separate form for each asking different questions.
I need to ensure that the product selection is passed to either of the two form for when the user makes the decision on which delivery option to opt for. Only one of the forms is submitted.
Basically I have:
Form1: Product Selection Radio Button (2 Options)
// Choice of delivery options hidden by a javascript reveal of the relevant form
Form2a: Digital download form fields with actions for validation and submission to Paypal
Form2b: Regualar delivery form fields with actions for validation and submission to Paypal
I look forward to a solution from the excellent minds on this site!
Assuming this is all on a single page, it sounds like you don't really need multiple forms. I would suggest just including everything in a single form, wrapping the applicable questions for each selection in separate <div> tags and using some JavaScript to present the applicable <div> when either radio button is selected. When the form is submitted, check the radio button selection on the server side to determine which other form fields to utilise.