I have a dynamic HTML form whereby I use Javascript to add/remove fields depending on what the user answers on the form. The form contains three steps with their own questions, and each step is disabled after the user completes it while the next step is automatically generated by my javascript code for them to continue filling out the form.
The problem I ran into was that I found all my disabled form elements were not submitted when the form was posted to PHP, and it turned out this was standard functionality. You can't submit disabled elements in a form, that's how it goes.
So I did the following:
$("#submitAll").click(function() {
enableStep1();
enableStep2();
});
So when the user clicks the submit button, they're taken to the thank you page and their form, for a split second before, is all enabled so that it would be submitted. I feel kind of nervous about this, is it a terrible idea and does anyone know what could go wrong?
I've already read about other solutions, like in this question here, but I'm wondering if my solution isn't completely terrible.