[JIRA] Commented: (OFBIZ-720) popups not identifying opener field properly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[JIRA] Commented: (OFBIZ-720) popups not identifying opener field properly

JIRA jira@ofbiz.org
     [ http://jira.undersunconsulting.com/browse/OFBIZ-720?page=comments#action_13608 ]
     
Marco Risaliti commented on OFBIZ-720:
--------------------------------------

Romà is this issue still present or it can be closed ?

Thanks a lot
Marco

> popups not identifying opener field properly
> --------------------------------------------
>
>          Key: OFBIZ-720
>          URL: http://jira.undersunconsulting.com/browse/OFBIZ-720
>      Project: [OFBiz] Open For Business
>         Type: Bug
>   Components: common
>     Versions: SVN
>  Environment: ubuntu breezy, jdk 1.4.2
>     Reporter: Romà Ferré Añaños
>     Assignee: Jira Administrator
>  Attachments: lookup.ftl
>
>
> We found that in a screen form with more than one popup field, the current mechanism fails to properly identify the field (in the main window) which was to receive the selected value.
> In a typical scenario, only one of the fields would receive the result of any of the popups.
> We inspected the javascript code in "framework/common/webcommon/includes/lookup.ftl" and found that the mechanism for locating the opener field depended on the URL parameter "id". This parameter is not properly passed on successive submits (or pages) in the popup, and it only takes the first submit on the "Lookup" button to lose the "id" parameter.
> We have designed a solution for this bug which relies on cookies, so that we can remember the id between pages.
> We rely upon typical javascript setCookie/getCookie functions.
> Here is the main part of our solution:
>         //let us prepare a regular expression which will alow us to extract the id parameter from the URL
>         // => this is guaranteed to work the first time we open up the popup
>         var re_id = new RegExp('id=(\\d+)');
>         //We set num_id to -1 in case of "no match" to remember this condition later
>         var num_id = (re_id.exec(String(window.location))
>                 ? new Number(RegExp.$1) : -1);
>         //Now we want to obtain the obj_caller...
>         var obj_caller;
>         if(num_id!=-1){
>        //an id was passed in, let us remember it...
>        setCookie("__popupNumId__",num_id);
>        obj_caller = (window.opener ? window.opener.lookups[num_id] : null);
>    }
>    else{
>     //No id was passed in, let us check if we have a remembered cookie
>        //let us see if we have a previous num_id saved as a cookie    
>        var oldNumId=getCookie("__popupNumId__");
>     if(oldNumId){
>     //we found a remembered id
>        obj_caller = (window.opener ? window.opener.lookups[oldNumId] : null);
>     }
>     else{
>     //oops!! abnormal situation
>     }
>    }
>         if (obj_caller == null)
>             obj_caller = window.opener;

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.undersunconsulting.com/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira