This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes html:text + struts + disable/readOnly problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:text + struts + disable/readOnly problem" Watch "html:text + struts + disable/readOnly problem" New topic
Author

html:text + struts + disable/readOnly problem

Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
am using struts html:text tag. when I am using

document.forms[0].myTextBoxProp.disabled=true;
or
document.forms[0].myTextBoxProp.readOnly=true;
document.forms[0].myTextBoxProp.readonly=true;


(note the font change for letter 'o').
The textbox field is neither disabled nor readonly( text box value is still being editable)

Any trciks or advises?

Thanks in advance to all the repsonders....


Srini
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
something that you might try is using the logic tag and having a boolean value that you can change between editable and non-editable, and having 2 different possible sets of display info.
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Thanks Knibbas. I thought of doing that and trying to know is there any mistake I am doing, before I go for a round about method.

I hope what you suggested is the only way.

The tags some times make our coding miserable.

Thanks again and enjoy your ' Thanks Giving' holiday.( Hope you are in USA)
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Originally posted by Puthriah Sarma:
Thanks Knibbs. I thought of doing that and trying to know is there any mistake I am doing, before I go for a round about method.

I hope what you suggested is the only way.

The tags some times make our coding miserable.

Thanks again and enjoy your ' Thanks Giving' holiday.( Hope you are in USA)
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Thanks again and enjoy your ' Thanks Giving' holiday.( Hope you are in USA)


No but thanks for the well wishing.

Hope it all works out for you.
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
Hereunder I am pasting the code that worked for me. This may be useful for other folks.

This may be a horrible way to do when there are more fields. But I found this as the only solution.

Any better thoughts are welcome..


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: html:text + struts + disable/readOnly problem
 
Similar Threads
Disabling all controls
Map-backed ActionForm Key value
making elemnt readonly and editabble
Javascript and Struts Indexed Text Boxes
pass a variable in the URl