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 DropDown Disabled. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DropDown Disabled." Watch "DropDown Disabled." New topic
Author

DropDown Disabled.

Prasad Tirumareddi
Greenhorn

Joined: Feb 17, 2005
Posts: 7
Hi,

I have a drop down , if i make it disabled i can't capture the value in my servlet. There is no option called readOnly for the dropdown. How can i achieve this.

Thanks,
Prasad.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
either you have to enable it right before the form is submitted or place the selected value into a hidden element.

Eric
Prasad Tirumareddi
Greenhorn

Joined: Feb 17, 2005
Posts: 7
Thank You Eric.

But the situation is like this .
The drop downs will be disabled on loading the form depending on the OID Roles / Groups. So sometimes the drop down will be enabled and sometimes not. So i don't know how many drop downs are enabled and how many are not. Making them enabled on submit or validating before submit is like a tedious task. I am looking for a solution by which i can get the values even though they are disabled. Is there any way that cetain style will show the dropdown as disabled but actually not disabled.

Thanks,
Prasad.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Anything you could come up with would be far messier than what Eric has already suggested. Personally, I'd go with the hidden variable solution.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kuldeep Vaishnav
Ranch Hand

Joined: May 23, 2004
Posts: 72
yea hidden fields needs to be used.


Kuldeep
Prasad Tirumareddi
Greenhorn

Joined: Feb 17, 2005
Posts: 7
Bear, i agree with Eric solution.

If i have 20 fields on my page , do you think that 20 hidden variables are to be created. And my pages span more than 20 fields.

I am trying for a better solution. Anyway if i don't i will go with Eric solution. Right now i codded according to Eric.

Thanks,
Prasad.
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
My guess is you already know when the fields are going to be disabled.
So when you are going to submit the form just change the action attribute of the form by adding all the disabled fields nd their values to the URL.
I know this involves javascript coding to some extent but then you wont need hidden variables.
Since you asked for another option here it is.
If i am wrong guys/gals please correct me.


Life called,so here I am.<br />Cheers<br />Niki.:-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DropDown Disabled.