You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2007/09/01 06:03:34 UTC

[jira] Updated: (STR-1598) [taglib] html:form focus function could be more powerful

     [ https://issues.apache.org/struts/browse/STR-1598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-1598:
-------------------------------

    Fix Version/s: Future
         Assignee:     (was: Struts Developers)

I like the anchor idea.

> [taglib] html:form focus function could be more powerful
> --------------------------------------------------------
>
>                 Key: STR-1598
>                 URL: https://issues.apache.org/struts/browse/STR-1598
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Taglibs
>    Affects Versions: 1.1.0
>         Environment: Operating System: other
> Platform: All
>            Reporter: herve
>            Priority: Minor
>             Fix For: Future
>
>         Attachments: patch_bug21514.zip
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.