File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drop Down value not stored for submit

 
Chinni Bujji
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • 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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't show the script. Are you disabling the control?
 
Kartik Tal
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all, it worked
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic