Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

Dropdown populates other fields

Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am have a dropdown 'select' that should populate several other fields on the page depending on which item was selected. My select objects come from a java object (I'm using jsps and jstl to iterate through the object list and populate the options.) Other fields in the java object would be the (default) values for the fields that are populated based on the selection. My intention is to populate arrays using javascript with the values contained in the object for each field and then use the selected index to access them and set the form values. My problem is how to get the extra fields out of the java object and into the javascript array. Here's where I'd like to do it:

How can I accomplish this? Thanks!
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done it two ways:

1 - create javascript arrays containing all possible values from within the java code

2 - use an ajax request to get new values.

Honestly, I've switched from 1 to 2.

Also honesly, I'm more a java guy that an html/javascript guy

All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!