Since Struts 1.2.7 the <html:form> tag now has "disabled" and "readonly"
attributes, which if set affect the controls contained in the form.

So if you use  <html:form disabled="true"> then the controls contained in
the form are disabled.

If you use  <html:form readonly="true"> then the controls contained in the
form are readonly.  According to the HTML 4 Spec. the "readonly" attribute
is only valid for <input type="text">, <input type="password"> and
<textarea> elements and so only the <html:text>, <html:password> and
<html:textarea> tags are affected by this setting.

I guess if you want a form to be "readonly" and you also have controls such
as <html:checkbox>, <html:radio> or <html:select> to be affected by the
setting then this doesn't provide a complete solution. It is relatively easy
to have custom versions of the struts tags for these kind of elements which
either emit a "readonly" attribute (some browsers support this even though
its not in the Spec) or do some other custom processing. The
prepareFocusEvents() method in BaseHandlerTag is the best place to look to
understand how this has been implemented in Struts.

Niall

----- Original Message ----- 
From: "Sudhaker Raj" <[EMAIL PROTECTED]>
Sent: Monday, August 29, 2005 4:05 PM



2. Do we have need of tag attribute like this?

<html:form mode="edit">
...
</html:form>

<html:form mode="confirm">
...
</html:form>

<html:form mode="show">
...
</html:form>

Setting the mode attribute to 'confirm' will convert all form-field
into a hidden field and will replace all editable area with a label
showing current values. Similarly setting mode attribute to 'show'
will simply replace all editable area with a label showing current
values.

The show mode can be very well used for followings

* Same JSP code can be used to show details and edit details.
* Confirm filled values before finally submitting.
* Form can be made read-only or editable based on user's credentials.

This can be further improved to control field level rendering and security.



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

Reply via email to