• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Disable html elements using CSS

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Is it possible to disable html elements ( text field, drop down) using CSS ? i know its possible using Java Script , just wondering if its possible using CSS; it is a requirement related to JSF , so if CSS can do the job it will make my job easy

Thanks,
Rajeev
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it does not need JavaScript and you can not do it with CSS

The elements have an attribute disabled which you need to set.

Eric
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The "when" and "how" of disabling them is what is important here.

For example, if the user selects a certain item from a combobox that may, depending on the value, enable or disable certain other HTML tags on the page. This should be done with a JavaScript function that changes state of the disabled attribute of form tags or even the visibility of other HTML tags.

If you are sending an entire page from the server via JSP/JSF or just by composing HTML in Java or with XSLT, then you should set this in the server. However it is initially set, if there is a possibility that the user can do something that will change it, then you should have the JavaScript option too.

Just my $0.02 worth.
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic