Dynamically associate DIV elements to a form

J

jonjon

Hi,
I'm developing a program which allows to dynamically associate form elements
(Input, Select, ...) to forms. Those elements are defined via CSS as abolute
positionned and they may be inside a DIV. The number of forms can be
unlimited (for example the user can associate one or many element to a
form). The philosophy of the program is to graphically (WYSIWYG) associate
any nmber of elements to any form.
It's getting harder with the generation of this webpage: How can I associate
the elements which could be part of a DIV or not to the same form ? I mean
if I have a select in the web-page and an input in a div of the same page,
which are both associated to the exact same form, how could I generate
efficient code ? I tried many things and none of them seems to work
correctly. Here is what I tried:

1- Use "Form.appendChild" to add the elements when onSubmit happens. This
could work however when an element is in a DIV and is appended to a child,
its position is changed :(

2- Create hidden fields in the form and dynamically set their value when
onSubmit occurs. This time the problem is how to handle possible invisible
elements ? And how to handle radio, check or multiple select ?

3- Create a mirror of the elements in the form and set them not as invisible
(or they won't be included in the form) but out of the web-page or 0x0 width
and height... this is extremly heavy in size and in management.

The ideal solution would be to dynamically create a form which handles all
associated elements when it is submitted, and without modifying the
appearance or position of thos elements.

If you have any suggestions, thought or starting point about this, I will
greatly appreciate your comments.

Thank you very much and best regards,

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top