• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DropDown Disabled.

 
Prasad Tirumareddi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64832
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kuldeep Vaishnav
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yea hidden fields needs to be used.
 
Prasad Tirumareddi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic