File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Drop Down value not stored for submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Drop Down value not stored for submit" Watch "Drop Down value not stored for submit" New topic
Author

Drop Down value not stored for submit

Chinni Bujji
Ranch Hand

Joined: Jan 31, 2007
Posts: 60
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

Joined: Jan 10, 2002
Posts: 60053
    
  65

Your code is full of JSP scriptlets. This is not a JSP forum. Please show the generated HTML only.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chinni Bujji
Ranch Hand

Joined: Jan 31, 2007
Posts: 60
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

You didn't show the script. Are you disabling the control?
Kartik Talasu
Ranch Hand

Joined: Aug 21, 2009
Posts: 98
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Jan 31, 2007
Posts: 60
Thank you all, it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drop Down value not stored for submit
 
Similar Threads
Scrollbar for table using div doesnt work in IE
link problem
tabbed form problem
What happen to this Tabbed form ?
URL parameter ~~howto ?