• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Spin through listbox items and update selection status

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form that contains several elements populated based on a database query. One such field is a list of employees which is basically the result of a select * sql. The listbox is correctly populated

The issue I'm having is that on a "edit" page I have a query that returns a specific record (lets say joe's record). What I need to do is spin through the list of possible items (Jack, Joe, Mary) and if the value matches the name returned in the second query then make the item selected. Here is how I think it would be done:
1) Populate listbox with all possible items
2) Select a specific transaction and return a name
3) Spin through listbox items and if the item value match the name then mark it selected.

Is this possible to do and if so how?
 
Sheriff
Posts: 67752
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
Why not just do it all while you're building the element?
 
nebber johnson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mainly because it is two different SQLs. But your suggestion is a good one, I believe I can store the results of the specific fetch and compare the "all" fetch with those results to populate.

Thanks!
 
Bear Bibeault
Sheriff
Posts: 67752
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 should be performing all database operations long before you get to the JSP.
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic