We help IT Professionals succeed at work.

How could i apply font color in my disabled textbox

427 Views
Last Modified: 2012-06-22
<tr class=RightCell>
                  <td align="right"><bean:message
                        key="label.housingTotals" /></td>
                  <td class=RightCell align="left"><html:text
                        property="facilityVO.housingTotalsPR" name="incomeStatementForm" disabled="true" style="bgcolor:blue;"
                          onblur='<%=renderResponse.getNamespace()+"calHousTotAH()"+ ";" + renderResponse.getNamespace()+"changeAmtFormat(this)" %>' onkeypress='<%=renderResponse.getNamespace()+"ValidDollar(this,event)"%>'
                                                onfocus='<%=renderResponse.getNamespace()+"removeAmtFormat(this)"%>' /></td>
                  <td align="right">&nbsp;</td>
                  <td class=RightCell align="left"><html:text
                        property="facilityVO.housingTotalsAH" name="incomeStatementForm" disabled="true" onblur='<%=renderResponse.getNamespace()+"changeAmtFormat(this)"%>' onkeypress='<%=renderResponse.getNamespace()+"ValidDollar(this,event)"%>'
                                                onfocus='<%=renderResponse.getNamespace()+"removeAmtFormat(this)"%>'/></td>
                  <td class=RightCell align="left" width="12%">&nbsp;</td>
                  <td class=RightCell align="left" width="12%">&nbsp;</td>
                  <td class=RightCell align="left" width="8%">&nbsp;</td>
                  <td class=RightCell align="left" width="8%">&nbsp;</td>
            </tr>
 
Comment
Watch Question

Manikandan ThiagarajanSenior consultant

Author

Commented:
i could not able to apply font color in disabled textbox
Top Expert 2009

Commented:
<html:text   property="facilityVO.housingTotalsPR" name="incomeStatementForm" disabled="true" styleClass="disabledBlue" >

.disabledBlue
{
background-color:blue; // this is for making the back ground color blue
color:blue;// this will make the font color blue
}

also why have you not included css zone?
CERTIFIED EXPERT

Commented:
<style type="text/css">
#box2 {
background:lightgrey;
color:red
}
<input type="text" name="box2" id="box2" onfocus="this.blur();" value="none" disabled="true">
Top Expert 2009

Commented:
@dravidnsr:

I do not think
<html:text> would allow Id
it should be styleId

Please read the question and assist in which ever way you feel the user can get best benefit.

also If there are ten disabled text boxes would you write ten css classes?
CERTIFIED EXPERT

Commented:
Hi kadaba,

I didnt see Question here after i will read the question properly .. thanks for ur advise ... man !!
CERTIFIED EXPERT

Commented:
i say only the subject that s the pblm ...
Top Expert 2009

Commented:
@dravidnsr

Please do not think I was being rude. I do not want anyone else to point out and say the same to you. (because many a times I have been asked :) to do the same) and of course as you know this is the place where we exchange information for good of all so , I will always be willing to help and willing to learn for you and from the exchange

:)

I really hope I did not strike the wrong chord.
CERTIFIED EXPERT

Commented:
No my dear kadaba .. i didnt think like that !! that my fault i didnt read the question properly ..
i saw the subject only thats the pblm ..Here i coming for upgarding myself ... i didnt use <html:text> thats y i didnt post any sloution after that !! ....
Thanks once again !!
Manikandan ThiagarajanSenior consultant

Author

Commented:
see thanks for your adivce

my question when text box is disabled it could not able to show the font color in text box

could you please give me the code for the code

that red colour is not reflected
Top Expert 2009

Commented:
If you are using IE then yes... the color style would not apply.
test this in both browsers.


<style type="text/css">
.disabled
{
	background-color:#CCCCCC;
	color:red;
}
</style>
<input type="text" readOnly="true" class="disabled" value="disabled">
<input type="text" disabled="true" class="disabled" value="disabled">

Open in new window

Top Expert 2009

Commented:
also as dravidnsr: pointed out have the onfocus="this.blur();"
and I hope you are following the html:text properties ..

My suggestion :
If you are disabling the text box why not show the value as a html:label value instead of showing i in the text box
Manikandan ThiagarajanSenior consultant

Author

Commented:
then how could i solve the problem

that is not possible to change the  font color in html:text

read only attribute is not supported in struts
Manikandan ThiagarajanSenior consultant

Author

Commented:
class attribute is also not supported in struts
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.