• 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

dropdown & javascript

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a jsp page and in the bottom of the page i have three dropdown list, 3rd one depends on 2nd. And 2nd dropdown depends on 1st one. Once I select 1st drop down, the page is refreshed and 2nd dropdown has new values. But when the page is refreshed, it stays at the begining of the page. So I have to scroll down everytime to select the 2nd dropdown and once i select the 2nd one, it is refreshed and again i have to scroll down for the 3rd one. Once I make the selection, is there a way the page should refresh and stay where the dropdown list are, instead of scrolling down. I using Javascript and in the javascript function i am calling struts action. Thanks a lot.
 
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
Well, you didn't say, but I assume you're looking for a way to avoid the page refresh?

If so, Ajax is the answer for you. With Ajax you can make a request back to the server when the value of a dropdown changes in order to fetch the data (and just the data) needed to populate the dependent dropdown.
 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I don't know AJAX. Could you please tell me any good sites where I can start learning AJAX and implement this task?

Or is there a way when the page is loaded can I bring the focus on the dropdown? Thanks
[ March 30, 2007: Message edited by: Venkat Babu ]
 
Bear Bibeault
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
Here's a tutorial on Ajax: http://developer.apple.com/internet/webcontent/xmlhttpreq.html

You can try just setting focus on the dropdown with a Javascript statement, but not having to refresh a page just for something like this would be a great tool to add to your repetoire.
 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great. Definitely I will look at it. Thanks. I will try to find how to bring the focus on the dropdown using Javascript. Do you or anyone can post a sample java script code of bringing the focus on a particular field in the form when the page is loaded.
 
Bear Bibeault
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 do have a Javascript reference handy, don't you?
 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actaully I don't. I very new to Javascript. Today is my third day using Javascript.
 
Bear Bibeault
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
Get yourself a good reference. I'd suggest either (or both) of the O'Reilly Flanagan or Goodman books.
 
Venkat Babu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great. Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic