Win a copy of Mastering Corda: Blockchain for Java Developers 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Drop Down value not stored for submit

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

I need a small suggestion, I am trying to replace the state drop down with a state text box when the country is not US
It does that logic, but when I submit the form the variable adminState doesnot hold the value of the state when it is submitted
When I do document.form.adminState.value, I get it as undefined
Please help me on this

 
Marshal
Posts: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code is full of JSP scriptlets. This is not a JSP forum. Please show the generated HTML only.
 
Chinni Bujji
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bear Bibeault
Marshal
Posts: 67497
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't show the script. Are you disabling the control?
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you are replacing the Dropdown box to Text box with some logic in Javascript or whatever.
But are you disabling the dropdown or just hiding it?
Seems to be as you declared dropdown and textbox with same name,at first its taking the dropdown value.

Try this steps
1) Remove dropdown and check whether you are able to get the "adminState" value of the textbox with "document.form.adminState.value".
2) If its coming then its sure its taking value of Dropdown only, then in your logic you have to disable dropdown in Javascript.



Regards,
Kartik
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As stated, you have two controls with same name, that means you will have a JS error since when you call document.formName.elementName it refers to an array of two elements, not one.

Rename the control or reference it via its index.

Eric
 
Chinni Bujji
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all, it worked
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic