• 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

How To Dynamically Display the Content of a Page that is Selected from a Menu?

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web page that displays a drop-down menu, a textarea, and a submit button.

The drop-down menu is for users to select "one" from a list of pages. Once the page is selected, the content of that page is supposed to show up in the textarea right below the drop-down menu and the user can start editing that page. Upon finishing editing, the user clicks on the Submit button.

To the best of my knowledge, it involves an action to search in the database tables to search for the page selected, and then, the content of the page can be displayed in the next step.

I have not used the JavaScript before. People suggest that I can use an onChange JavaScript listener on the drop-down that submits to an Action -- that Action retrieves the data for the textarea and forwards back to the original form. Could anybody guide me to do it?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaScript is not going to be able to get the information from the database, you are going to have to submit the page back to the server in order to place the information into the text box.

Eric
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me that it can be done. Would you please just take a look at
https://www.swern.gov/forms/enrollmeform.php

and scroll down a little below half way. There is a drop-down menu for the 'Select Program Group'. And there is a textarea right below that drop-down menu.

Simply select a group from the drop-down menu, you will see a description of that program group appears in the textarea. I wonder how it is done.
 
Sheriff
Posts: 67747
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
Move your mouse cursor to Edit. Click. Select View Source. Click. Read.

You will see that all those selections are preloaded into the huge HTML file loaded into the browser.
 
This tiny ad is wafer thin:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic