Hi Marcos,

I am handling the readonly field behaviors by javascript. 

For example, based on the current CRUD mode, the action form must set a
property called "readonlyFields" with a comma-separated list of all fields
in the form that will be displayed as readonly on the client browser.

<input type="hidden" name="readonlyFields"
value="bau_bkost,bau_bdatpe,bau_bdatbw,bau_bdatbb,bau_bdatbe">

Then at the onload event of the body tag, a javascript function will split
the "readonlyFields" value and for each one will set its readonly attribute
to "true" or do other things according to its type (text, select, ...).

Adriano Labate


-----Original Message-----
From: Scriven, Marcos [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 18, 2001 3:32 PM
To: 'Struts Users Mailing List'
Subject: 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:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

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

Reply via email to