• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read only Form  RSS feed

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there some way to make a form read only using struts or some other way. I don't want to keep duplicate copies, one for Read only and other editable. Any input in this direction will be greatly appreciated.

Thanks
Vicky
 
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try consulting:

http://jakarta.apache.org/struts/userGuide/struts-html.html#text

the answer will jump right out at you.
 
vicky kumar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
This is at the field level. I'm wndering if there is some way to make a form read only at the form level. This would avoid maitianing 2 copies of the form.

Can we do something in javascript. I mean, what if I iterate through all the elements of the form in javascript and disable them all.

Can any one else has a better idea ?

Cheers
Vicky
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vicki,
<%
String readOnly = "";
if(formIsReadOnly){ // however you plan on checking this
readOnly = "readonly='readonly'";
}
%>
<html:text property="shtuff" <%= readOnly %> />
<html:text property="moreShtuff" <%= readOnly %> />
...
 
I'm so happy! And I wish to make this tiny ad happy too:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!