You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Haster (JIRA)" <ji...@apache.org> on 2011/09/07 18:11:11 UTC

[jira] [Commented] (WICKET-3961) nextFocusedElementId to be added to the AjaxRequestHeaders (AjaxRequestTarget)

    [ https://issues.apache.org/jira/browse/WICKET-3961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13099065#comment-13099065 ] 

Sven Haster commented on WICKET-3961:
-------------------------------------

That contains the id of the last-focused-element (AjaxRequestTarget even returns the contents of that header when you call getLastFocusedElementId()). In my example, that would be the id of textfield A. What I would like to see is the id of textfield B (or whatever component happens to be selected next which triggered the onblur on A).

> nextFocusedElementId to be added to the AjaxRequestHeaders (AjaxRequestTarget)
> ------------------------------------------------------------------------------
>
>                 Key: WICKET-3961
>                 URL: https://issues.apache.org/jira/browse/WICKET-3961
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket
>    Affects Versions: 1.5-RC5.1
>            Reporter: Sven Haster
>            Priority: Minor
>              Labels: ajax
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I'd like to have a field/request header "nextFoxusedElementId" to be added to ajaxrequests (to be retrieved via AjaxRequestTarget.getNextFocusedElementId() ) so that I can append javascript to the ajaxrequest to manipulate the newly focused element.
> Example:
> Two textfields, A and B. I've added an ajax event behavior for the "onblur"-event to textfield A. Now when textfield A has focus and I then move focus to textfield B, wicket writes the id of textfield A to the ajaxrequest, saves the id of textfield B, removes focus from textfield B, handles ajaxrequest (including any and all javascript) and then refocuses textfield B.
> However, I want the text inside textfield B to be highlighted. I can append javascript to the ajaxrequest to do #textfieldB.select() and set focusComponent(null) on the AjaxRequestTarget but what if textfield B is not the newly focused component? What if the focus instead went to checkbox C, for instance? Since I don't know what element received the focus I can't check to see if it's textfield B. That's why I'd like to be able to request the newly focused component from the ajaxrequest.
> AFAICT, this shouldn't be too much work, since the id of the newly focused component is already saved, so it looks like it might just be a case of waiting for that save to be done. But maybe that is an oversimplification and is it quite tricky (or is the wait-time too long) to get the sending of the ajaxrequest to wait for the new component to receive focus.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira