• 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

populating textarea from dropdown box selection

 
Ranch Hand
Posts: 57
  • 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 drop-down list which is populated dynamically from a database table

I'm trying to populate a textarea when a selection is made from a drop-down box on the same page

Is anyone able to show mw how to do this?

My code for the drop-down box


What i then want to do is take the 'id' value (from the selection made from the drop-down box) and pass this to another sql query e.g. select * from table1 where id = <%=id%>, so i can get the contents and populate the textarea which is on the same page as the drop-down box

any help much appreciated
 
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
You have a grave misconception regarding how JSP works. All that code that you have in the JSP is executing on the server long before the page is sent to the browser. So it is impossible for it to react to on-page events such as dropdown selections.

Perhaps this article will shed some light on what really goes on during the life-cycle of a JSP.

After reading it, you should understand why the approach you propose can never work, and that you need to use Javascript, perhaps with the help of some Ajax, in order to accomplish what you are trying to do.
[ April 02, 2007: Message edited by: Bear Bibeault ]
 
dale conn
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got this working now

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic