• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic content based on drop down.

 
hari ganesh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a dropdown ,and based on its value I will have to create some other dropdowns and text boxes in the same page.Currently I am using iframe.Based on the dropdown value I show and hide contents in the iframe.The problem in this situation is that when I submit the iframe all the component (both hidden and shown) get submitted.

Is there any better way of doing this?

Thanks in advance.

Regards,
Hari
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using MVC approach:

The JSP sends only the parameter from the first dropdown. if condition is met, the servlet sends back array to populate the second drop down etc.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modern methods use Ajax to perform "behind the scenes" requests to fetch the subsequent data. Please see topics in the HTML forum as this is a common question.
 
hari ganesh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajax can be used,but then I will have to dynamically create the elements and position it.I am using the MVC approach.
Apart from the stated requirements I have to display the validation error if the validation fails and if it succeeds then I have to popup a new window.How can I go about doing that

Thanks & Regards,
Hari
 
Thara Visu
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hari,
Do you know the maximum number of fields you need to have in your form? If yes, you could code the fields with dummy values and not display them. When the combo box is chosen, you do a submit and when page loads you can display the other fields based on choice. Hope that made some sense.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by hari ganesh:
Ajax can be used,but then I will have to dynamically create the elements and position it.I am using the MVC approach.


No, you do not have to dynamically create the elemens, and yes, Ajax can be used in an MVC approach.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!