Reputation: 5419
This title is kind of vague so let me explain it first. I'm developing an application that is very "custom-control" heavy. I have to create lots of custom drop-down selection menus and visual controls instead of a normal <form>
with inputs, buttons, etc.
Naturally, the problem is passing data with these custom-made <div>
controls. Is the best way to go about doing this to have hidden input elements that populate and submit their values when these custom controls are used?
Hopefully this question won't be closed for being too "open-ended" or "opinion-based." All I am wondering is what the industry standard/common practice is.
Upvotes: 1
Views: 31
Reputation: 303
Unfortunately due to the fundamental functionality of forms you must use the traditional input tags in order for submit form to actually work. There are two easy answers to this problem.
To conclude, unless you absolutely have to you create your own inputs, you should not because they are specifically designed to deal with a lot of different situations (such as backwards compatibility and disability compensation).
Upvotes: 0
Reputation: 4951
The best way is to style the default controls to match whatever look you want. Browsers and user-agents parse form elements in a certain way, which makes your sites accessible. Using custom controls bypasses all of the considerations that have been implemented to deal with text-to-speech users, color-blind people, etc.
Upvotes: 1