Author
dynamic HTML
frank braunstein
Ranch Hand
Joined: Dec 17, 2009
Messages: 41
posted Feb 09, 2010 01:32:22
hey there folks,
a little question: I want my html form to be dynamic. For instance, the user chooses an entry from a dropdown box and according to what he chooses the rest of the site laying under the dropdown box changes immediatley. I can remember having seen that on the internet and its quite common. How can i achieve such site behaviour?
thanks for replies...
Chinna Eranna
Ranch Hand
Joined: Dec 08, 2009
Messages: 126
posted Feb 09, 2010 02:00:42
Use frames..
http://www.w3schools.com/html/html_frames.asp
- Chinna
frank braunstein
Ranch Hand
Joined: Dec 17, 2009
Messages: 41
posted Feb 09, 2010 02:03:35
I dont like frames! Isn't there another option? Something i could do with JSP's ?
Chinna Eranna
Ranch Hand
Joined: Dec 08, 2009
Messages: 126
posted Feb 09, 2010 02:08:20
frank braunstein wrote:
I dont like frames! Isn't there another option? Something i could do with JSP's ?
Any particular reason ?
You can also do it through JSP.
Say.. you have two values in select Box (1, 2) and two layouts to be displayed.. layout1 and layout2.
In the main jsp, you can have select box with these two values.. and include layout1.jsp and layout2.jsp depending on the value of the select box..
Whenever user changes the value in select box.. refresh the whole page.
- Chinna
frank braunstein
Ranch Hand
Joined: Dec 17, 2009
Messages: 41
posted Feb 09, 2010 02:12:52
Chinna Eranna wrote:
frank braunstein wrote:
I dont like frames! Isn't there another option? Something i could do with JSP's ?
Any particular reason ?
You can also do it through JSP.
Say.. you have two values in select Box (1, 2) and two layouts to be displayed.. layout1 and layout2.
In the main jsp, you can have select box with these two values.. and include layout1.jsp and layout2.jsp depending on the value of the select box..
Whenever user changes the value in select box.. refresh the whole page.
I was thinking too complicated. thank you very much...
Eric Pascarello
author
Sheriff
Joined: Nov 08, 2001
Messages: 13583
posted Feb 09, 2010 05:50:02
Frames? Are we back in the 90's, nope just checked my calendar.
You need to have an onchange event to look at the form field value or text
You can just show and hide the fields on the page. It is as simple as
Eric
Race Schedule for 2010 for this running geek:
* National Half Marathon - 03/20 [1:44:51] * Frederick Marathon - 05/02 * Baltimore Marathon - 10/16 *
Bear Bibeault
Author and opinionated walrus
Sheriff
Joined: Jan 10, 2002
Messages: 36607
posted Feb 09, 2010 08:46:42
Chinna Eranna wrote: Use frames
Frames? 1999 called and wants their site back!
Chinna Eranna wrote: Whenever user changes the value in select box.. refresh the whole page.
Another antiquated approach from days when browsers were much less capable.
In modern browsers, showing and hiding elements dynamically is easy. Even creating new elements on the fly has become commonplace with the help of JavaScript libraries.
There is no need to resort to out-dated methods like frames and full-page refreshes.
This message was edited 2 times. Last update was at Feb 09, 2010 08:49:37 by Bear Bibeault
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]