You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org> on 2007/04/19 15:59:15 UTC
[jira] Commented: (TOMAHAWK-965) Add ability to JSCookMenu to
invoke javascript and actiom method at the same
[ https://issues.apache.org/jira/browse/TOMAHAWK-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490069 ]
Mike Kienenberger commented on TOMAHAWK-965:
--------------------------------------------
This is not the correct way to solve this issue.
Submit patches to support something along these lines:
<t:navigationMenuItem
itemLabel="Something"
action="#{myBean.actionMethod}"
javscript_action="alert('myBean.actionMethod will be invoked')" />
Note that your patches need to be in unified diff format, not just snippets of text.
http://wiki.apache.org/myfaces/Contributing_Patches
> Add ability to JSCookMenu to invoke javascript and actiom method at the same
> ----------------------------------------------------------------------------
>
> Key: TOMAHAWK-965
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-965
> Project: MyFaces Tomahawk
> Issue Type: Improvement
> Components: JS Cook Menu
> Affects Versions: 1.1.6-SNAPSHOT
> Reporter: Adrian Mitev
>
> In MyFacesHack.js:
> if (link != null)
> {
> //-------------- Add this code
> //searches for javascript$action notation
> if (link.match(/\w*:A\].*\$/) != null) {
> expr = link.replace(/^\w*:A\]/, "");
> jsExpr = expr.replace(/\$.*/,"");
> eval(jsExpr);
> link = link.replace(jsExpr,"").replace("\$","");
> }
> //-----------------------
> // changes by Richard J. Barbalace
> if (link.match(/^\w*:A\]\w*:\/\//) != null ) {
> // Link is a URL
> link = link.replace(/^\w*:A\]/, ""); // Remove JSF ID
> window.open (link, target);
> } else if (link.match(/^\w*:A\]\w*:/) != null ) {
> // Link is a script method
> link = link.replace(/^\w*:A\]\w*:/, ""); // Remove JSF ID
> eval(link);
> } else {
> // Link is a JSF action
> var dummyForm = document.forms[target];
> dummyForm.elements['jscook_action'].value = link;
> dummyForm.submit();
> }
> }
> This addition searches for action that contains javascript code and expression separated by $. Splits them and invokes the javascript code. Example:
> <t:navigationMenuItem itemLabel="Something" action="alert('myBean.actionMethod will be invoked')$#{myBean.actionMethod}" />
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.