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 CSS for dropdown and textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "CSS for dropdown and textbox" Watch "CSS for dropdown and textbox" New topic
Author

CSS for dropdown and textbox

sudharshan tettu
Ranch Hand

Joined: Jul 17, 2006
Posts: 124
I have a scenrio like
in disabled state of the page the drop down should look like a text box with the value populated when hit on edit and the page gets enabled then it should be visible like a normal
dropdown
Is there anyway to achieve this using css. Can we define a style sheet using and make dropdown look like textbox in disabled state

anyhelp greatly appreciated
Thanks
Sudharsan
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The reason you do not set the textbox to be actually disabled is?

Eric
sudharshan tettu
Ranch Hand

Joined: Jul 17, 2006
Posts: 124
No you havenot got the problem correctly.

On the page its actually a select box. and in disabled mode. but it needs to be visible like a text box

my requirement is , is there anyway applying styles we can make a dropdown appear as a text?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
So you want the user to be able to look at the options? weird...

Well you will not be able to get it to look exactly disabled, but something like:




If you want it to be exactly like a textbox, than make it a textbox. When it is in the "edit mode", than hide the textbox and show the select element.

Eric
sudharshan tettu
Ranch Hand

Joined: Jul 17, 2006
Posts: 124
Thanks eric for your reply....

i thought of toggling between text and select but i have around 40 dropdowns per page......

or else is there anyway of changing font properties when select box is disabled.
I mean the client complains when select is disabled , text in it is not legible
is there anyway to make it appear Bold or turn the greyed out font inside select box to black or anyother color

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not style a disabled element, you can style a readOnly element.

Eric
sudharshan tettu
Ranch Hand

Joined: Jul 17, 2006
Posts: 124
oh ok
then is that possible to do the other way , to make readonly seelct to appear as a disabled and make that back ground appear grayed out like when disabled...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
sudarsan tettu wrote:oh ok
then is that possible to do the other way , to make readonly seelct to appear as a disabled and make that back ground appear grayed out like when disabled...


Try it. Use basic css and see what happens.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CSS for dropdown and textbox