1

i have a button in worklistManager.jsp which calls a function(getWorklistManagerModify()).. the function is inside utility.js file, which in turn do some action and redirects to worklist.jsp page with its response.. how to open worklist.jsp page in the same tab or same window of worklistManager.jsp.. now its opening as a separate tab.

getWorklistManagerModify function:

function getWorklistManagerModify(){
    var whereCondn = "";
    //alert(gbshowgridFlag);
    if(dijit.byId('finderResponseGridCWPWORKLIST')){
        var selctedItem = dijit.byId('finderResponseGridCWPWORKLIST').selection.getSelected();
        if(selctedItem.length){
            dojo.forEach(selctedItem, function(selectedItem){
                if(selectedItem !== null){
                    dojo.forEach(dijit.byId('finderResponseGridCWPWORKLIST').store.getAttributes(selectedItem), function(attribute){
                        var value = dijit.byId('finderResponseGridCWPWORKLIST').store.getValues(selectedItem, attribute);
                        //alert(value);
                        if(attribute == "CWDOCID"){
                            whereCondn = whereCondn+attribute+"="+value;
                        }
                        //alert(whereCondn);
                    });
                    var cols= "DUE_DATE,PRIORITY,CWDOCID";
                    var ioArgs = {
                            url: "./DynamicDBServlet",
                            content: { TABLE_NAME:'CWPWORKLIST',WHERE_CONDN:whereCondn,COLUMNS:cols,ACTION:'select'}, 
                            handleAs: "text",
                            load: function(response) {
                            postRequestPage("worklist.jsp",response,'title');

                            },
                            error: function(error) {
                                alert("An unexpected error occurred: " + error);
                            }
                    };
                    var deferred = dojo.xhrPost(ioArgs);

                }
            });
            //alert("grid row selected");
        }else{
            alert("Please select a task");
        }
    }
    if(gbshowgridFlag==false){
        alert("Please select a task");
    }
}

function to send post request:

function postRequestPage(url, params, name){
    alert(params);
    var form = document.createElement("form");
    form.setAttribute("method", "post");
    form.setAttribute("action", url);
    form.setAttribute("target", name);
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = "PARAM";
    input.value = params;
    form.appendChild(input);
    document.body.appendChild(form);
    window.location.href = url;
    //window.open(url,"_self");
    form.submit();
    document.body.removeChild(form);
}

i tried using window.location.href, window.open, location.href and window.location... nothing worked out..

1 Answer 1

2

remove this line;

form.setAttribute("target", name);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.