Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting value of Disabled field

 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have html select element which i am disabling with onClick of Button,
but in next jsp i am getting its value as null
see the code if option is one and i clicks on button select element gets disabled with value is one but i am not geeting that value "one" in next page , is there any way to get this value
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disabled means disabled. The value of a disabled control does not get submitted.
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If before making it disabled ..suppose i am setting its value explicitly then is it possible
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is disabled before the form is submitted it will not matter what its initial state was, it still will not be sent.

Eric
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now suppose user is selecting Hocky then there is no point in selecting crickect bat and soccer ball , rite ? thats why i need to disabled it
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You either enable it when the form is sent, or you have a hidden field with the value in it.

Eric
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not we dont have control on form its runtime gets generated and for hidden values, its not every time i need to disabled field it will based on specific condition

and its not possible to have two fields with same name , you join our company you will get to know more
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dumb question that must be asked: if you don't want the field disabled, then why are you disabling it?
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Bear,

Let me explain in general terms




 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see above if i am selecting hocky then there is no point in selecting cricket bat and soccer ball rite?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So then, why do you care that it's disabled? You can't have it both ways. If it doesn't matter, why do you care that it's not getting submitted?
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok let me explain i have "stuffs" attribute in database which accept only string attributes not even empty string if my field is disabled i am getting null value and setting of attribute value is done by other API to which i can not modified ..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's really simple to detect null and replace it with the empty string.
 
ravindra patil
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear, i have the solution of this issue but its not that good
i am working on product based company ...i work on the layer which is already defined , i can't touch even that kind of final class
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic