[ 
https://issues.apache.org/jira/browse/TOMAHAWK-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628394#action_12628394
 ] 

Paul Rivera commented on TOMAHAWK-1183:
---------------------------------------

I've checked in the svn comments and found out that the addition of 
ONBLUR_ATTR, ONFOCUS_ATTR to MyFaces Shared 3.0.x 
Html.EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK was intended to fix MYFACES-1608. 
 Although, this fix has affected:

- HtmlButtonRendererBase
    This class uses BUTTON_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONCLICK. 
 After the change made for MYFACES-1608, onfocus appears twice in this string 
array.  If you have a commandButton in your page that has an onfocus attribute, 
onfocus will be rendered twice.

- HtmlTextHelpRenderer
    This class uses 
INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK and 
expects this array to _not_ contain 'onfocus' and 'onclick' because it has 
selectText() and resetHelp() functions that need to be called in onfocus and 
onclick.  After the change made for MYFACES-1608, the 'onfocus' attribute gets 
added into 
INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK and 
causes the onfocus attribute to be rendered twice.

The patch above will:
- rollback changes made by MYFACES-1608.  Instead of modifying 
EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK, the fix for MYFACES-1608 has been 
placed in ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE and 
ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE to reduce the impact.

The array ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_ONCLICK_WITHOUT_STYLE is used 
by HtmlLinkRendererBase and ToggleLinkRenderer. 
ANCHOR_PASSTHROUGH_ATTRIBUTES_WITHOUT_STYLE is used by HtmlLinkRendererBase.  
I've already tested the fix on both myfaces shared 2.0.x and 3.0.x and it does 
solve MYFACES-1608.

HtmlButtonRendererBase will also no longer render onfocus attribute twice.

- fixes HtmlTextHelpRenderer.renderHelpTextAttributes().  We should not have 
multiple onfocus or onclick attributes rendered.  If the user supplies some 
onfocus javascript function, we should add it like:
onfocus="selectText('Enter Birthdate Here', 
'mainForm:birthdate');someUserFunction()"
This implementation is similar to what ToggleLinkRenderer does in 
buildOnclickToggleFunction().
I've already tested this and onfocus now works on both tomahawk 1.1.x and 
tomahawk 1.2.x.

the patch fixes both inputCalendar rendered as popup or inline.

- fixes ToggleLink to be able to process onfocus and onblur events.

It seems like we have a lot of changes here.  But I can't really separate them 
to be able to solve this issue.

> inputCalendar setfocus not working
> ----------------------------------
>
>                 Key: TOMAHAWK-1183
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1183
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.6
>         Environment: windows xp
>            Reporter: richard lee
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The inputCalendar tag / component is not rendering javascript entered for the 
> setfocus property. I'm attempting to add some custom javascript to the 
> setfocus of an inputcalendar to be run when the user clicks in the input box 
> associated with the calendar, but this is being ignored during the redering 
> of the input box. The only javascript that gets rendered is the "standard" 
> javascript , i.e. onfocus="selectText('null', 'con9n')".
> I believe the issue is in HtmlTextHelpRenderer:
> if(isSelectText(component))
>             {
>                 HtmlRendererUtils.renderHTMLAttributes(writer, component,
>                                                        
> HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_ONFOCUS_AND_ONCLICK);
>                 writer.writeAttribute(HTML.ONFOCUS_ATTR,
>                                       
> HtmlInputTextHelp.JS_FUNCTION_SELECT_TEXT + "('" +
>                                       getHelpText(component) + "', '" + id 
> +"')", null);
>                 writer.writeAttribute(HTML.ONCLICK_ATTR,
>                                       
> HtmlInputTextHelp.JS_FUNCTION_SELECT_TEXT + "('" +
>                                       getHelpText(component) + "', '" + id 
> +"')", null);
>             }
> when writing out the HTML.ONFOCUS_ATTR is should write out any user specified 
> onfocus attributes as well as the standard ones.

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

Reply via email to