my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes How To Dynamically Display the Content of a Page that is Selected from a Menu? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How To Dynamically Display the Content of a Page that is Selected from a Menu?" Watch "How To Dynamically Display the Content of a Page that is Selected from a Menu?" New topic
Author

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

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Nov 19, 2000
Posts: 1309
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60817
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
wood burning stoves
 
subject: How To Dynamically Display the Content of a Page that is Selected from a Menu?
 
Similar Threads
How to automatically change the page contents with change in drop down list option selection
submit button + selecting content of field automatically
Retain selected content in a drop down menu
ajax dynamic combo
Remote Scripting