You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Scriven, Marcos" <Ma...@gs.com> on 2001/11/18 15:32:09 UTC

reusing form for readonly

Hi

I have a form which can be in several different modes: VIEW, ADD, EDIT, and
DELETE

If I am in view mode (which I have enumerated as 0 in an interface called
WebConstants.VIEW), I want the values in my <html:text> fields to be
readonly.

I can do this on a field by field basis, as such:

        <logic:equal name="productForm" property="action" scope="request"
value="<%=String.valueOf(WebConstants.VIEW)%>">
            <html:text styleClass="form2" property="tradeProduct.ISIN"
size="17" maxlength="17" readonly="true"
onBlur="javascript:validateName(this);" />
        </logic:equal>
        <logic:notEqual name="productForm" property="action" scope="request"
value="<%=String.valueOf(WebConstants.VIEW)%>">        
            <html:text styleClass="form2" property="tradeProduct.ISIN"
size="17" maxlength="17" onBlur="javascript:validateName(this);" />
        </logic:notEqual>        

However, is there a shorter/more succinct way? I have many fields within my
form, and adding all these equal/notEqual tags adds a lot of lines to my JSP


Thanks

Marcos

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>