I was wondering if anyone could point me in the right direction.
I am intending on making a complex form. The form has may aspects that the user can add dynamically.
So we have a parent form, f1. Inside this we have a button called 'Add new block' - from here a new legend opens below with a table inside to which users can as many individual rows with new content as they wish.
This trend repeats as many times as the user would like.. So we can end up with a form, with two inner forms, each of those can have two more inner forms, and so on.
Using the <form> tag etc, doesn't really work well, by this I mean there is always an area that is a bit hacky. Using iframes can become confusing as there are times that the content needs to be defined, however we don't know what any of the content will look like nor contain.
I'm confused with an approach, one that will be user friendly and not require a masters to figure out the flow.
I have thought of making each individual inner form as a separate html page, where there is a blank table with loads of empty options, and the users fills these in accordingly. However this means that I have to have a potentially unlimited number of empty boxes residing on the page (as I do not know how many aspects the user will add).
It can be done this way, however it is a bit mechanical in its flow, and does not give the user complete freedom..
You may be aware that I am not a Web Developer at heart, I know some fundamentals, however I am being encouraged at the moment to output something grand, for proof of concept.
Thanks greatly for any hints or suggestions,
You can't nest forms and you can't nest HTML pages. And I'm not sure why you were headed down that path anyways...
Simply add the new elements to the form. If there are repeating elements, the parameters will simply end up as an array on the server.
I think you are making this much more complicated than it needs to be.
Joined: May 17, 2011
Exactly, how do you add these new elements?
I cannot seem to find a decent example of such a process.
DOM manipulation is a rather advanced topic for a novice. You're best bet is to adopt one of the libraries like jQuery or Dojo that makes this process a lot easier. Even so, you've got a steep learning curve ahead of you.
If you are using Servlets and JSP on the back end, and are more familiar with those technologies, you might consider "cheating" and using Ajax (again, via jQuery) to simply fetch pre-formatted fragments to stick into the DOM rather than creating the element on-the-fly in script.
Joined: May 17, 2011
See this aspect will be of a greater system. So the overall system willl be hosted on the cloud, so therefore I will be running servlets, and I have used some JSP throughout already.
So using Ajax/JQuery would be the method then? Do you have links to some decent examples or tutorials?