• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

textbox -> Disable Vs. ReadOnly

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
It is only recently (and after quite a frustrating time) have i come to discover the subtle differences between these two attributes of text elements in a form. While disable renders the text unchangeable (not to mention the faint grey shade too), ReadOnly surprisingly does the same too. But, the difference lies in what happens after the form has been submitted. Surprising as it may seem, "Disabled" field values cannot be retrieved from the request object while the "ReadOnly" ones can be!!!
Can anyone shed some more light on this?! Besides the rendering of text in the light grey shade is their any other reason why someone should prefer Disable over ReadOnly??
And while we are on this topic, can anyone tell me if using "ReadOnly" also can one render the disabled text "Light Grey"?
 
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can change the css of a ReadOnly element to appear disabled.

Eric
 
Bear Bibeault
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can anyone shed some more light on this?!



Disabled means just that: the control is disabled so no submission of its value will occur. readOnly meerely sets the control so that it cannot be edited, but does not disable the control.
 
I knew that guy would be trouble! Thanks tiny ad!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!