You could use a JSP expression to output the readonly='true' attribute of
the html:text or use the html-el library and use jstl to evaluate the
attribute.

Edgar

> -----Original Message-----
> From: Chris Gastin [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 25, 2003 12:29 AM
> To: [EMAIL PROTECTED]
> Subject: Editable Fields V/S Static Text
> 
> 
> Has anyone considered a feature which toggles between an 
> editable form element and read only text / static text.
> 
> I find myself developing JSPs where depending  on the Use 
> Case "fieldA" could be an editalbe text box (<input 
> name="fieldA" value="My Text Value"
> />)  in Use Case 1 on xyz.jsp and readonly text /static text  
> in Use Case 2 (My Text Value) on the same jsp. Presently I am 
> using the <logic:equal></logic:equal> tags. Which get really 
> messy. Here is some sample code.
> 
> <logic:equals name="actionForm" property="myFieldEditable" 
> value="true">
>     <html:text name="actionForm" property"myField" /> 
> </logic:equal> <logic:equals name="actionForm" 
> property="myFieldEditable" value="false">
>     <bean:write name="actionForm" property"myField" /> </logic:equal>
> 
> 
> It would be nice to add an attribute to the current tag 
> libraries, which is a boolean, and does this toggling for 
> you. Here is what I am envisioning
> 
> If actionForm.myField = "My Text Value"; This tag  <html:text 
> name="actionForm" property"myField" readOnlyText="true"/> 
> would output "My Text Value".
> 
> Where <html:text name="actionForm" property"myField" 
> readOnlyText="false"/> the following tag would output <input 
> name="fieldA" value="My Text Value" />
> 
> As you can imagine this would not be a huge undertaking to 
> add this feature to the current tag libraries in struts. I 
> could use this feature, and I am sure other could too. I am 
> willing to contribute my time to the development effort. I am 
> not stuck on the attribute name "readOnlyText", and would 
> welcome suggestions. Does this sound like a good idea, and if 
> the answer is yes, what is the next step.
> 
> Chris Gastin
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to