• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating a value based on the option selected in the dropdown

 
anita prat
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jsp here I have a drop down list that contains the list of franchises. There is nother field franchise code on the jsp which will have the value populated based on the valkue in the drop down. These two are properties of a form bean Franchise which is available in the form bean associated with the jsp.
FranchiseVO bean has properties franchisename and franchisecode. THe names appear in the dropdown. Based on the franchisename selected , the value of the franchise code should get populated. How do I acheive this? Do I need to use a hidden parameter to pass to the javascript?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends what you mean by "selected". Do you mean:

  • The value that will be set as selected by the JSP -- and therefore known at page-generation time.
  • The value that will be chosen by the end user after the page has been displayed in the browser.
  •  
    anita prat
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The value that will be chosen by the end user after the page has been displayed in the browser.
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 65216
    95
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well, by that time the JSP has been evaluated on the server and is long gone. So you'll need to handle the change event for the dropdown on the client using JavaScript.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic