DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21514>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21514

html:form focus function could be more powerfull

           Summary: html:form focus function could be more powerfull
           Product: Struts
           Version: 1.1 Final
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


tag Form can generate dynamically javascript to put focus on a field element. 
This function is excellent for the first page access. But, in my web 
application, when a form is submit, many controls are made and we try to return 
specific errors for each element to give best help to our clients.
For this, we use Errors tags to explain each error under each element.

Good but not enough. We would like to give focus on a field specificaly related 
with error. This function is not implemented in the taglib HTML or it's simple, 
don't affect functions already present and give more power to the dynamic focus.

Our solution :
We implement ErrorsTag to add a new property with the same function as focus 
property in FormTag.
Implementation
ErrorsTag : When we find a correspondant error, value of this new property is 
set in the pageContext, in request scope. When this is done one time, this 
value isn't change if other errors are sent.
So, we have in memory the first field associated with the first error found and 
defining it.
FormTag : in doEndTag(), focusField value is tested. If exists, it have 
priority on focus form property. So we affect this new value to focus property.

That all for focus

We can go further and add an anchor to this error and scroll automatically to 
this anchor before giving focus to the field associated.

It work fine, give a better result and more power to the focus property.

As it's optionnal, there's no problem if someone is not interested ... but I'm 
sure many programmers using forms need that !

This is not really a bug but I don't know anywhere else to submit.
Thanks

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

Reply via email to