Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Dropdown Selected returning unexpected value on submit.  RSS feed

 
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks ,
Im trying to use a dropdown as part of the html form in the page im creating.The dropdown works in the following manner--
When I click or change the values in the dropdown the page reloads and the selected value is retained (using JavaScript), (expected behavior).However, when I submit the page using the submit button , I try to pass the value of the selected value(from the dropdown) through a script so that the value of the dropdown is passed correctly for DB operations, however the value is always set to -1.
and as result im not able to insert or update or perform any operations that occure after i press the submit button.
Im placing the code snippet from my jsp that I use for generating the dropdown and setting the selected value in a hidden field.
File:JSP

Servlet , where the value from dropdown is obtained and used for further processing.

here the value of setDtID is set to -1 , and not the dropdown selection ,every time I perform a submit . Any clue as to why this could be happening? Thanks for your time . Any help would be appreciated.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it .. Forgot to set the value of the hidden field .. my bad :\
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!