• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic content based on drop down.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
no wonder he is so sad, he hasn't seen this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic