• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

nested FORM

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we have nested FORMs ?
I need to display a text field first and an add button . The user
has to click add button whenever he wants to add more rows. The new row should show up along with the old row.
There will a submit button to submit the form finally.
The form is containing numerous fields.
I am generating the form thru servlets.
Any idea please?
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe nested forms is allowed. But the truth is I have never tried it. What I would do in your case is use one form, and make the Add Rows button a "button" and not a submit button. Then have an onClick event that calls a javascript function to do what you want. If you are going to be adding more form fields to the form, without going back to the server, you would use DHTML and have layers that you would make visible when someone clicks that button.
If you want them to go back to the server, so you have an "Add More Rows" button that goes back to the server, and a "Submt" button that goes back to the server, make you Add More Rows a type button that calls a javascript function that changes the action on your form to be the page that has the extra rows, and then do a form.submit() call. The Submit buttons action can be the action if they don't want more rows.
At any event, I think I tried to have nested forms once, and ran into problems, so I went this route from then.
Hope that helps.
Bill
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think bill is right...even if you could have nested forms I don't see how that solves your problem, the only way you can change their visibility is by using layers or div which will work with a simple form just as well and when the user is done finished creating the form and wants to submit it your servlet will receive all the fields (including the invisible ones) but the fields invisible to the user will be null thats all ....and bill i am sorry i will re-register ASAP
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem manav. I appreciate you helping us out there
    Bookmark Topic Watch Topic
  • New Topic