Results 1 to 2 of 2

Thread: Pop up

  1. #1
    Punter is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Question Pop up

    I have a page new_cpdc.jsp on which I have given a button. on clicking this button I have given a popup window select_list.jsp to select list of names.I am giving drop down list. contents of which r fetched from the database.
    Now, I want to get all names selected on the popup window onto the main parent window
    Currently, I am saving all selected names in a Vector. It works with Mozilla but on with IE.
    Pls help

    this is the function which is being called on clicking button on popup window - select_list.jsp
    ************************************************** ************************
    function call_parent(){

    var t = document.getElementById('tblApprover');
    var lastRow = t.rows.length; alert("lastRow :- " + lastRow);
    var iteration= lastRow-2; alert("iteration :- " + iteration);
    var selvalues = new Array();

    for(var i=1;i<=iteration;i++){
    var dropdownIndex=document.forms[0]['optusername'+i].selectedIndex;
    alert("dropdown :- " + dropdownIndex);alert(" i :- " + i);
    selvalues[i]=document.forms[0]['optusername'+i].options[dropdownIndex].value;
    alert(selvalues[i]);
    }

    /* for(i=1;i<=iteration;i++){
    document.write(selvalues[i]);
    } */

    window.close();
    }



    ******************** new_cpdc.jsp ************* part of code

    /**
    * Function for add new approver in list
    */
    function addRowToTable()
    {
    var tbl = document.getElementById('tblApprover');
    var lastRow = tbl.rows.length;
    // if there's no header row in the table, then iteration = lastRow + 1
    var iteration = lastRow -1;
    var row = tbl.insertRow(lastRow);

    // left cell
    var cellLeft = row.insertCell(0);
    var textNode = document.createTextNode(iteration);
    cellLeft.appendChild(textNode);

    // text box
    var cellRight = row.insertCell(1);
    var el = document.createElement('input');
    el.type = 'text';
    el.name = 'txtRow' + iteration;
    //alert(el.name);
    el.id = 'txtRow' + iteration;
    el.size = 29;

    el.onkeypress = keyPressTest;
    cellRight.appendChild(el);

    // middle combo box
    var cellMiddleSel = row.insertCell(2);
    var sel0 = document.createElement('select');
    sel0.name = 'optusername'+iteration;
    sel0.options[0] = new Option('Select Approver Name','selectname');
    cellMiddleSel.appendChild(sel0);

    for(var i=0;i<document.forms[0]['optusername1'].options.length;i++)
    {
    sel0.options[i] = new Option(document.forms[0]['optusername1'].options[i].text,document.forms[0]['optusername1'].options[i].text);
    cellMiddleSel.appendChild(sel0);

    }

    // Last combo box
    var cellRightSel = row.insertCell(3);
    var sel1 = document.createElement('select');
    sel1.name = 'selCol'+iteration;

    sel1.options[0] = new Option('Select Approver Mailid','selectmail');
    cellRightSel.appendChild(sel1);
    for(var i=0;i<document.forms[0]['optmailid'].options.length;i++)
    {
    sel1.options[i] = new Option(document.forms[0]['optmailid'].options[i].text,document.forms[0]['optmailid'].options[i].text);
    cellRightSel.appendChild(sel1);
    }
    }

  2. #2
    neeraj.singh is offline Member
    Join Date
    Feb 2009
    Location
    Delhi
    Posts
    63
    Rep Power
    0

    Default

    i am not sure about syntax, but you can do the following,
    gather the comma separated ids into a hidden form variable,
    then pass back using window.opener(google it for exact code)
    then you can again refresh the opening page then with the comma separated ids you can grab the names there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •