RamaGeeks
RamaGeeks

Reputation: 45

Get The Value on Window.opener.function on javascript

First, I open a new window with this

  $('input#btn_show').click(function(event){
NewWindow("?mod=autorisasi_report", "autorisasi", 600, 400, "no");}
    );

then if the authorization successful, it will open the window opener

function run_submit(){
        window.opener.doreport(frm);

    window.close();
    return false;
}

but the problem is in function doreport

function doreport(frm)
{
   if(frm.reptype.value == 'income_statement_period')
   {
    popFullScreen("print.php?mod=accounting_report_print&cmd="+frm.reptype.value+'&is_excel='+frm.is_excel.value+'&ryear='+frm.ryear.value+'&rmonth='+frm.rmonth.value+'&gpid='+frm.gpid.value+'&coaid='+frm.coaid.value+'&coaid2='+frm.coaid2.value+'&tbtype='+frm.tbtype.value+'&startdate='+frm.startdate.value+'&enddate='+frm.enddate.value+'&{SID}'+'&cctype='+frm.cctype.value,frm.reptype.value);
   }
}

<form name="frm" id="frm" action="" method="GET" style="width: 700px;">
 ... 
<select name="reptype" onchange="change_reptype(frm);">
    <option value='trial_balance'> Trial Balance</option>
</select>
 ...
</form>

the frm.reptype is undefined, what must I do to get the reptype value?

Upvotes: 1

Views: 696

Answers (1)

Hendri Faisal Hidayat
Hendri Faisal Hidayat

Reputation: 61

You have problem with variable frm in function run_submit. There are no declaration for this. You should declaration first in function run_submit.

Or you can declaration frm in function do_report with this

var frm = document.getElementByID('frm');

Because you need declaration your form first.

Upvotes: 2

Related Questions