Solved

showModalDialog issue

Posted on 2006-06-27
6
1,166 Views
Last Modified: 2012-06-21
I have an page that contains a button with an onClick event to call a function that does a showModalDialog.  The problem is that if the user click on one button on the page that brings up a popup to do another task, then quickly clicks the other button that opens the modal dialog window the window will A) not open or B) open blank. are there certain conditions that need to be met before a modal dialog will operate correctly
0
Comment
Question by:jduawa
6 Comments
 
LVL 20

Expert Comment

by:Gawai
ID: 16994325
can u paste our ful code here. it will make us easy to solve ur problem
0
 
LVL 1

Author Comment

by:jduawa
ID: 16994395
The page uses ajax and calls to DB objects so if i just paste the code from that page it probably wouldnt help much but here it is

<cfobject component="#APPLICATION.componentpath#.commonQueries" name="objQuery">
<cfset codingLines=objQuery.numInvoiceLines(invoice_id=#URL.i#)>

<cfobject component="#APPLICATION.componentpath#.invoices" name="objInvoices">
<cfset getInvoiceData = objInvoices.getInvoiceData(invoice_id=#URL.i#) />
<!-- http://devnull.tagsoup.com/quirksmode -->
<!--- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> --->
<html lang="en">
<head>
<cfif URL.r EQ "a">
      <title>Approve Invoices</title>
<cfelseif URL.r EQ "p">
      <title>Process Invoices</title>
</cfif>
<SCRIPT src="scripts/common.js" type=text/javascript></SCRIPT>
<SCRIPT src="scripts/toolbar.js" type=text/javascript></SCRIPT>
<script type="text/javascript" src="scripts/simModal.js"></script>
<script src="scripts/makeRequest.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
// function to run upon closing the dialog with "OK".
function setPrefs( ) {
    // Statements here to apply choices from the dialog window
}
</script>
<style type="text/css" media="screen">
      @import "css/fixed4all.css";
</style>
<!--[if IE]>
<link href="css/ieFix.css" rel="stylesheet" type="text/css" media="screen">
<style>
      
      div#header {overflow: hidden; width: 240px; position: absolute; top: 0; left: 0; color: #000; background: #ffffff;
                        height:35px;/*height:expression(window.document.body.clientHeight-document.getElementById('content').offsetHeight)*/}

      div#content {overflow: hidden; width: 240px; position: absolute;
                              left:0px;
                    bottom: 0px;
                              background: #ffffff;
                              height:expression(window.document.body.clientHeight-document.getElementById('header').offsetHeight)
                              
                        }
      div#footer {overflow: hidden; width: 240px; position: absolute;
                              left:0px;
                    bottom: -1px;
                              background: #D4D0C8;
                              height:25px;
                              border-top: 1px solid #808080;
                        }

      div#invoicePDF {overflow: hidden; position: absolute;
                              left:240px;
                              top:0px;
                              background: #D4D0C8;
                              border-top: 1px solid #808080;
                              height:expression(window.document.body.clientHeight);
                              
                        }
      .invIframe{
                        height:expression(window.document.body.clientHeight);
                        width:expression(window.document.body.clientWidth-document.getElementById('content').offsetWidth);
                        border:none;
                        margin-top:-1px;
      }
</style>
<![endif]-->
<link href="css/forms.css" rel="stylesheet" type="text/css" media="screen">
<!--- Instantiate the users.cfc object --->
<cfobject component="#application.componentpath#.users" name="objUser"/>

<cfif URL.r EQ "a">
      <cfobject component="#application.componentpath#.approveDeny" name="objAD"/>
      <cfset okToApprove=objAD.bossOkToApprove(#URL.i#)>
</cfif>

<script>
      var saveInv;
      function saveInvoice(){
            document.getElementById('status').style.visibility="hidden";
            var paymentTypeId = 1;
            var netSettlement="null";
            var checkRequest="null";
            var invSite = document.forms["invoice"].vendor_site_id.value==""?"null":document.forms["invoice"].vendor_site_id.value;
            var invNumber = document.forms["invoice"].invoice_number.value==""?"null":document.forms["invoice"].invoice_number.value;
            var invDate = document.forms["invoice"].invoice_date.value==""?"null":document.forms["invoice"].invoice_date.value;
            var invAmount = document.forms["invoice"].invoice_amount.value==""?"null":document.forms["invoice"].invoice_amount.value;
            var vendorID = document.forms["invoice"].vendor_id.value==""?"null":document.forms["invoice"].vendor_id.value;
            //var invoiceStatus = document.forms["invoice"].vendor_needed.value==""?7:1;
            var accountNumber = document.forms["invoice"].account_number.value==""?"null":document.forms["invoice"].account_number.value;
            var invoiceDescription = document.forms["invoice"].invoice_description.value==""?"null":escape(document.forms["invoice"].invoice_description.value);
            //var processedBy = document.forms["invoice"].processed_by.value==""?"null":document.forms["invoice"].processed_by.value;
            if(document.forms["invoice"].payment_type_id){
                  paymentTypeId=document.forms["invoice"].payment_type_id.options[document.forms["invoice"].payment_type_id.selectedIndex].value;
            }
            if(document.forms["invoice"].net_settlement){
                  netSettlement=document.forms["invoice"].net_settlement.checked==true?"Y":netSettlement;
            }
            if(document.forms["invoice"].check_request){
                  checkRequest=document.forms["invoice"].check_request.checked==true?"Y":checkRequest;
            }
            xmlData=invSite+"|"+document.forms["invoice"].invoice_id.value+"|"+invNumber+"|"+invDate+"|"+invAmount+"|"+vendorID+"|"+accountNumber+"|"+invoiceDescription+"|"+paymentTypeId+"|"+netSettlement+"|"+checkRequest;
            //alert(xmlData);
            //alert(document.forms["invoice"].vendor_needed.value);
            //return false;
            saveData(xmlData,"save_invoice.cfm?x=");
      }
function getXMLHTTP2(){
  var A=null;
  try{
    A=new ActiveXObject("Msxml2.XMLHTTP")
  }catch(e){
    try{
      A=new ActiveXObject("Microsoft.XMLHTTP")
    } catch(oc){
      A=null
    }
  }
  if(!A && typeof XMLHttpRequest != "undefined") {
    A=new XMLHttpRequest()
  }
  return A
}
function saveData(xData,saveURL){
  if(saveInv&&saveInv.readyState!=0){
    saveInv.abort()
  }
  saveInv=getXMLHTTP2();
  if(saveInv){
    // We end up calling:
    // /complete/search?hl=en&js=true&qu=<my query string...> ...
      
    saveInv.open("GET",saveURL+xData,true);
      
    // Note that this function will ONLY be called when we get a complete
    saveInv.onreadystatechange=function() {
      
      if(saveInv.readyState==4&&saveInv.responseText) {
            if(saveInv.responseText==1){
                  document.getElementById('status').style.visibility="visible";
                  document.getElementById('status').className="savedOK";
                  document.getElementById('status').innerHTML="Invoice saved.";
                  fadeOut();
            } else {
                  document.getElementById('status').style.visibility="visible";
                  document.getElementById('status').className="savedError";
                  document.getElementById('status').innerHTML="There was a problem saving the invoice. - " + saveInv.responseText;
                  //fadeOut();
            }
      }
    }
    ;
    // DON'T TRY TO TALK WHEN WE'RE LOCAL...
    // Comment out when running from a local file...
    saveInv.send(null);
  }
}      
function fadeOut() {
      document.getElementById('status').style.filter="blendTrans(duration=5)";
      if (document.getElementById('status').filters.blendTrans.status != 2){
            document.getElementById('status').filters.blendTrans.apply();
            document.getElementById('status').style.visibility="hidden";
            document.getElementById('status').filters.blendTrans.play();
      }
}

function createInvoiceNumber(inv_date){
      if(document.getElementById('no_inv_number').checked==true){
            if(inv_date==""){
                  alert("Make sure an invoice date is entered to auto-generate an invoice number.");
                  document.getElementById('no_inv_number').checked=false;
                  return false;
            }else {
                  document.getElementById('acctNum').style.display="block";
                  document.getElementById('account_number').readOnly=false;
                  document.getElementById('invoice_number').readOnly=true;
                  document.getElementById('check_request').checked=false;
                  document.getElementById('invoice_number').value="";
                  if(document.getElementById('account_number').value != ""){
                        generateInvoiceNumber();
                  }
            }
      }else{
            document.getElementById('invoice_number').value="";
            document.getElementById('account_number').value="";
            document.getElementById('acctNum').style.display="none";
            document.getElementById('account_number').readOnly=true;
            document.getElementById('invoice_number').readOnly=false;
      }
      checkApvLimit();
}
var invNum="";
function generateInvoiceNumber(){
      if(document.getElementById('account_number').value.stripChars(" ") != ""){
            invNum=document.getElementById('invoice_date').value.replace(/\//g,"");
            invNum=document.getElementById('account_number').value.stripChars(" ")+"-"+invNum;
      } else {
            invNum="";
      }
      document.getElementById('invoice_number').value=invNum;
}

function checkRequest(){
      if(document.getElementById('check_request').checked==true){
            if(document.getElementById('invoice_date').value != ""){
                  document.getElementById('account_number').value="";
                  document.getElementById('invoice_number').value="ChkRq"+"-"+document.getElementById('invoice_date').value.replace(/\//g,"")+"-"+document.getElementById('current_time').value
                  document.getElementById('no_inv_number').checked=false;
                  document.getElementById('acctNum').style.display="none";
            } else {
                  alert("Make sure an invoice date is entered to auto-generate an invoice number.");
                  document.getElementById('check_request').checked=false;
                  return false;
            }
      }
      else {
            document.getElementById('invoice_number').value=invNum;
      }
}
/*
function enlargeInvoice(){
      winH = window.screen.availHeight * 0.9;
      winW = window.screen.availWidth * 0.9;
      window.open("<cfoutput>http://#cgi.server_name#/online_invoices/#DateFormat(getInvoiceData.email_ts,'YYYY')#/</cfoutput>"+document.getElementById('invoice_id').value+".pdf","enlargeWin","resizable=yes,status=0,toolbar=0,scrollbars=yes,width="+winW+",height="+winH+",top=50,left=50");
}*/

function checkApvLimit(){ //if invoice amount is above the persons limit return false else return true
      if(parseFloat(document.getElementById('invoice_amount').value) > parseFloat(document.getElementById('approval_lmt').value)){
            //changeButtons();
            return false;
      }
      else {
            //changeButtons();
            return true;
      }
}
/*
function checkApvLimit(){ //if invoice amount is above the persons limit return false else return true
      if(parseFloat(document.getElementById('invoice_amount').value) > parseFloat(document.getElementById('approval_lmt').value)){
            if(!checkRequired()){
                  document.getElementById('approve_submit').src="images/submit_invoice_disabled.gif";
            }else{
                  document.getElementById('approve_submit').src="images/submit_invoice.gif";
            }
            document.getElementById('approve_submit').alt="Submit Invoice";
            return false;
      } else {
            if(checkRequired()){
                  document.getElementById('approve_submit').src="images/approveinvoice.gif";
            }else{
                  document.getElementById('approve_submit').src="images/approve_invoice_disabled.gif";
            }
            document.getElementById('approve_submit').alt="Approve Invoice";
      }
      return true;
}*/
function validateForm(){
      if(document.getElementById('invoice_number').value == ""){
            alert("The invoice must have an invoice number.");
            return false;
      }
      if(document.getElementById('invoice_date').value == "" ){
            alert("You must enter an invoice date.");
            document.getElementById('invoice_date').focus();
            return false;
      }
      if(document.getElementById('invoice_amount').value == ""){
            alert("You must enter an invoice amount.");
            document.getElementById('invoice_amount').focus();
            return false;
      }
      if(document.getElementById('vendor_needed').value == "" &&
            (document.getElementById('vendor_site_id').value == "" && document.getElementById('vendor_id').value == "" )){
                  alert("You must choose a vendor or select that the vendor or site needs to be created.");
                  return false;
      }
      if(document.getElementById('coding_complete').value != 1){
            alert("You must complete the coding to submit the invoice.");
            return false;
      }
      changeButtons();
}

function changeButtons(){
      //everything filled out and allowed to approve this invoice
      if(checkRequired() && checkApvLimit()){
            //alert("a");
            document.getElementById('approve_submit').src="images/approve_inv.gif";
            document.getElementById('approve_submit').alt="Approve Invoice";
      }
      //everything NOT filled out and they are allowed to approve this invoice
      if(!checkRequired() && checkApvLimit()){
            //alert("b");
            document.getElementById('approve_submit').src="images/approve_inv_disabled.gif";
            document.getElementById('approve_submit').alt="Approve Invoice";
      }
      //everything filled out and user NOT able to approve this invoice
      if(checkRequired() && !checkApvLimit()){
            //alert("c");
            document.getElementById('approve_submit').src="images/submit_inv.gif";
            document.getElementById('approve_submit').alt="Submit Invoice";
      }
      //everything NOT filled out and user NOT able to approve this invoice
      if(!checkRequired() && !checkApvLimit()){
            //alert("d");
            document.getElementById('approve_submit').src="images/submit_inv_disabled.gif";
            document.getElementById('approve_submit').alt="Submit Invoice";
      }
}

function submitForm(){
            if(checkRequired()){
                  saveInvoice();
                  document.forms["invoice"].target="_self";
                  document.forms["invoice"].submit();
            }
            else {
                  alert("In order to submit or approve an invoice all invoice fields, coding and vendor selection must be complete.\nIf you are seeing this message then one of those 3 items are incomplete.");
                  return false;
            }

      //parent.ProcParent.cols = "0,*";
}

function checkRequired(){
      //alert(document.getElementById('v_vsid_po_ok').value);
      if(((document.getElementById('vendor_site_id').value != "" &&
                  document.getElementById('vendor_id').value != "") || document.getElementById('vendor_needed').value != "") && 
                        document.getElementById('invoice_number').value != "" &&
                              document.getElementById('invoice_date').value != "" &&
                                    document.getElementById('invoice_amount').value != "" &&
                                          parseFloat(document.getElementById('coding_complete').value) >= 1 &&
                                                validVendorandInvNum && codingOpened()){
                                                if(document.getElementById('prior_coding_total').value!=""){
                                                      if(parseFloat(document.getElementById('prior_coding_total').value) != parseFloat(document.getElementById('invoice_amount').value)){
                                                            //alert("The previously coded amount does not match the invoice amount.");
                                                            return false;
                                                      }
                                                }
                                          return true;
      }
      return false;
}

function codingOpened(){
      if(document.getElementById("opened_coding")){
            if(document.getElementById("opened_coding").value==1){
                  return true;
            }
            else{
                  return false;
            }
      }else{
            return true;
      }
}
function checkInvoiceIDandVendor(){
      if(document.invoice.invoice_number.value!="" && document.invoice.vendor_id.value!=""){
            url= "http://<cfoutput>#cgi.server_name#/#APPLICATION.app_path#</cfoutput>/request_validate_vendor_and_invoice_number.cfm?in="+document.invoice.invoice_number.value+"&vid="+document.invoice.vendor_id.value+"&iid="+document.invoice.invoice_id.value;
            loadRequest(url);
      }
}
var validVendorandInvNum=true;
function validateInvoiceIDandVendor(z){
      if(parseInt(z)>0){
            validVendorandInvNum=false;
            alert("The combination of the vendor and the invoice number must be unique.");
            document.invoice.invoice_number.value="";
            changeButtons();
            document.invoice.invoice_number.focus();
      }
      else{
            validVendorandInvNum=true;
            changeButtons();
      }
      
}

function denyInvoice(){
      //var i=document.getElementById('invoice_id').value;
      PageToPageNavigate('Approve Invoices', false , null, "deny_invoice.cfm?i=<cfoutput>#encryptIt(url.i,session.key)#&r=#url.r#</cfoutput>");
      //parent.Content.location.href=
      //document.invoice.action="";
      //document.invoice.submit();
}

function deleteInvoice(){
      if(confirm("You are about to delete this invoice and all its related data.\nAre you sure you want to proceed?")){
            invokeRequest("delete_invoice.cfm?invid=<cfoutput>#encryptIt(url.i,session.key)#</cfoutput>");
            location.href="process_invoices.cfm";
      }
      else{
            return false;
      }
}
function chkAcctNum(){
      if(document.forms["invoice"].account_number.value!=""){
            document.getElementById('acctNum').style.display="block";
      }
}

function openCoding(){
      if(document.getElementById('referrer_type').value=="a"){
            if(parseFloat(document.getElementById('pa').value) != parseFloat(document.getElementById('invoice_amount').value)){
                  alert("The invoice amount you entered does not match the invoice amount entered by the processor.\n\nPlease re-enter the invoice amount or click the \"Override\" button below to correct the invoice amount.");
                  document.getElementById('invoice_amount').value="";
                  document.getElementById('invoice_amount').focus();
                  return false;
            }
      }
      //openSimDialog('code_invoice.cfm?inv_id=<cfoutput>#URL.i#</cfoutput>', 800,640, setPrefs,null,200,50);return false;
      TopFrame.showModalDialog("code_invoice_modal.cfm?inv_id=<cfoutput>#URL.i#</cfoutput>",window.self,"dialogHeight: 640px; dialogWidth: 800px; dialogTop: 50px; dialogLeft: 200px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
}
function openVendor(){
      if(parseInt(document.getElementById("v_vsid_po_ok").value) > 0){
            alert("This invoice was already coded to a PO.\n\nIf you need to change vendors, please delete the coded PO lines, choose a new vendor then re-code the lines.");
            return false;
      }else{
            openSimDialog('select_vendor.cfm?i=<cfoutput>#URL.i#</cfoutput>', 600,325, setPrefs,null,400,200);return false;
      }
}
function checkOther(){
      if(document.getElementById('payment_type_id')){
            if(document.getElementById('payment_type_id').options[document.getElementById('payment_type_id').options.selectedIndex].value==2){
                  if(document.getElementById('net_settlement')){
                        document.getElementById('net_settlement').checked=false;
                  }
            }
      }
      if(document.getElementById('net_settlement')){
            if(document.getElementById('net_settlement').checked==true){
                  if(document.getElementById('payment_type_id')){
                        if(document.getElementById('payment_type_id').options[document.getElementById('payment_type_id').options.selectedIndex].value==2){
                              document.getElementById('payment_type_id').selectedIndex==1;
                        }
                  }
            }
      }
}

function invCodedToPo(){
      url= "http://<cfoutput>#cgi.server_name#/#APPLICATION.app_path#</cfoutput>/request_was_coded_to_po.cfm?i="+document.invoice.invoice_id.value;
      //alert(url);
      loadRequest(url);
}
function setHidden(v){
      document.getElementById('v_vsid_po_ok').value=v;
}

function overrideAmount(){
      TopFrame.showModalDialog(VirtualRoot + "/override_amount_modal.cfm?inv_id=<cfoutput>#encryptIt(url.i,session.key)#</cfoutput>",window.self,"dialogHeight: 325px; dialogWidth: 600px; dialogTop: 50px; dialogLeft: 200px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;");
}

function formatNumber(){
      val=document.invoice.invoice_amount.value;
      if(val != ""){
            if(!isNaN(val)){
                  document.invoice.invoice_amount.value=parseFloat(val).toFixed(2);
            }
            else {
                  document.invoice.invoice_amount.value=""
                  return false;
            }
      } else {
            return false;
      }
}
function initPage(){
      Initialize();
      setTimeout("invCodedToPo()",10);
      //alert(document.getElementById('v_vsid_po_ok').value);
      SyncTitleAndHelp('xxx.htm');
      //checkApvLimit();
      checkModal();
      chkAcctNum();
      checkInvoiceIDandVendor();
      changeButtons();
      //alert(document.getElementById('coding_complete').value);
      <cfif URL.r EQ "a">
            //document.getElementById('invoice_amount').focus();
      </cfif>
}
</script>

            

</head>
<body onLoad="initPage();" onfocus="return checkModal();" style="BACKGROUND-COLOR: #f5f5f5;">
<div id="invoiceForm">
<div id="header">
      <div id="bar">
            <table cellspacing=0 cellpadding=0 height="30px" width=100%>
                  <tr>
                        <td valign="middle">
                              <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');" onclick="saveInvoice();" src="images/save_invoice4.gif" width="48" height="25" align="middle" alt="Save Invoice">
                         </td>
                        <td valign="middle">
                              <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');" onclick="openVendor();" src="images/choose_vendor4.gif" width="89" height="25" align="middle" alt="Select a Vendor" id="vendorImg"><!--- onclick="window.open('select_vendor.cfm','vendorWin','resizable=yes,status=0,toolbar=0,scrollbars=yes,width=600,height=325,top=150,left=450');" --->
                         </td>                        
                        <td valign="middle">
                              <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');" onclick="openCoding();" src="images/code_invoice4.gif" width="47" height="25" align="middle" alt="Code Invoice" id="codingImg"><!---  onclick="window.open('code_invoice.cfm','codingWin','resizable=yes,status=0,toolbar=0,scrollbars=yes,width=650,height=370,top=150,left=200');"  --->
                         </td>
                  </tr>
            </table>
      </div>
</div>
<div id="content">
<form name="invoice" action="submit_invoice_action.cfm" method="POST">
<DIV ID="status" STYLE="width: 100%;padding:2px;" class="savedOk"></DIV>
<cfoutput>
      <input type="hidden" name="vendor_site_id" <cfif getInvoiceData.vendor_site_id NEQ "">value="#getInvoiceData.vendor_site_id#"<cfelse>value=""</cfif>>
      <input type="hidden" name="vendor_id" id="vendor_id"<cfif getInvoiceData.vendor_id NEQ "">value="#getInvoiceData.vendor_id#"<cfelse>value=""</cfif>>
      <input type="hidden" name="coding_total" value="">
      <input type="hidden" name="approval_lmt" <cfif objUser.getAPLimit() GT 0>value="#objUser.getAPLimit()#"<cfelse>value="0"</cfif>>
      <input type="hidden" name="vendor_needed" <cfif getInvoiceData.vendor_needed NEQ "">value="#getInvoiceData.vendor_needed#"<cfelse>value=""</cfif>>
      <input type="hidden" name="invoice_id" value="#URL.i#">
      <input type="hidden" name="coding_complete" value="#codingLines#" id="coding_complete">
      <input type="hidden" name="processed_by" <cfif getInvoiceData.processed_by_id NEQ "">value="#getInvoiceData.processed_by_id#"<cfelse>value=""</cfif>>
      <input type="hidden" name="form_complete" value="">
      <input type="hidden" name="v_vsid_po_ok" value="99">
      <input type="hidden" name="current_time" value="#TimeFormat(Now(),'HHmmss')#">
      <input type="hidden" name="referrer_type" value="#URL.r#">      
      <input type="hidden" name="prior_coding_total" <cfif getInvoiceData.coding_amount NEQ "">value="#LTRIM(RTRIM(NumberFormat(getInvoiceData.coding_amount,"9999999.99")))#"<cfelse>value=""</cfif>>
      <cfif URL.r eq "a">
            <input type="hidden" value="0" name="opened_coding" id="opened_coding">
            <input type="hidden" value="#numberFormat(getInvoiceData.invoice_amount,'0.00')#" name="pa" id="pa">
      </cfif>
</cfoutput>
<table cellpadding=0 width=100% border=0>
      <tr>
            <td width=45%>
                  <table border=0 cellpadding=0 cellspacing=0>
                        <tr>
                              <td class="input">
                                    Inv. Date: &nbsp;
                              </td>
                              <td class="input">
                                    <input class="input" name="invoice_date" <cfif getInvoiceData.invoice_date NEQ "">value="<cfoutput>#DateFormat(getInvoiceData.invoice_date,"MM/DD/YYYY")#</cfoutput>"<cfelse>value=""</cfif> size="15" onfocus="this.blur()" readonly onBlur="checkDate(this.value,this);createInvoiceNumber(document.invoice.invoice_date.value);changeButtons();"><a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(document.invoice.invoice_date);return false;" HIDEFOCUS><img class="PopcalTrigger" align="absmiddle" src="scripts/popCal/inv_form/calbtn.gif" width="34" height="22" border="0" alt="">
                                    <!--- <input type="text" name="invoice_date" <cfif getInvoiceData.invoice_date NEQ "">value="<cfoutput>#DateFormat(getInvoiceData.invoice_date,"MM/DD/YYYY")#</cfoutput>"<cfelse>value=""</cfif> class="input" onBlur="checkDate(this.value,this);changeButtons();"> --->
                              </td>
                        </tr>
                        <tr>
                              <td class="input">
                                    Invoice #: &nbsp;
                              </td>
                              <td class="input">
                                    <input type="text" name="invoice_number" id="invoice_number" <cfif getInvoiceData.invoice_number NEQ "">value="<cfoutput>#getInvoiceData.invoice_number#</cfoutput>"<cfelse>value=""</cfif> class="input" onBlur="checkInvoiceIDandVendor();changeButtons();" size="30">
                              </td>
                        </tr>
                        <tr>
                              <td colspan=2>
                                    <span id="acctNum" style="display:none;">
                                          <table cellspacing=0 cellpadding=0 width=100%>
                                                <tr>
                                                      <td class="input" width=71>
                                                            Account #: &nbsp;
                                                      </td>
                                                      <td class="input">
                                                            <input type="text" name="account_number" id="account_number" class="input" onBlur="changeButtons();" onKeyUp="generateInvoiceNumber();" readonly <cfif getInvoiceData.account_number NEQ "">value="<cfoutput>#getInvoiceData.account_number#</cfoutput>"<cfelse>value=""</cfif> size="30">
                                                      </td>
                                                </tr>
                                          </table>
                                    </span>
                              </td>
                              
                        </tr>
                        <tr>
                              <td class="input" colspan=2>
                                    <table cellspacing=0 cellpadding=0 width=100%>
                                          <tr>
                                                <td class="input" width=80>
                                                      No Inv. Number
                                                </td>
                                                <td class="input">
                                                      <input type="checkbox" name="no_inv_number" class="input" onClick="createInvoiceNumber(document.invoice.invoice_date.value);" <cfif getInvoiceData.account_number NEQ "">checked</cfif>>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                        </tr>
                        <tr>
                              <td class="input" colspan=2>
                                    <table cellspacing=0 cellpadding=0 width=100%>
                                          <tr>
                                                <td class="input" width=80>
                                                      Check Request?
                                                </td>
                                                <td class="input">
                                                      <input type="checkbox" name="check_request" id="check_request" class="input" onClick="checkRequest();" <cfif getInvoiceData.check_request NEQ "">checked</cfif>>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                        </tr>
                        <tr>
                              <td class="input">
                                    Inv. Amount: $
                              </td>
                              <td>
                                    <input type="text" name="invoice_amount" id="invoice_amount" <cfif URL.r EQ "a">value=""<cfelseif URL.r EQ "p"><cfif getInvoiceData.invoice_amount NEQ "">value="<cfoutput>#LTRIM(RTRIM(NumberFormat(getInvoiceData.invoice_amount,"9999999.99")))#</cfoutput>"<cfelse>value=""</cfif></cfif> class="input" onKeyUp="changeButtons();" size="30" onBlur="formatNumber();">
                              </td>
                        </tr>
                        <cfif objUser.paymentTypeOptionCheck(objUser.getUserID()) EQ 1>
                              <tr>
                                    <td>
                                          Payment Type:
                                    </td>
                                    <td>
                                          <cfquery name="getPaymentTypes" datasource=#APPLICATION.DSN# cachedwithin="#createtimespan(3,0,0,0)#">
                                                select * from payment_types
                                          </cfquery>
                                          <select name="payment_type_id" class="select" onChange="checkOther();" id="payment_type_id">
                                                <cfoutput query="getPaymentTypes">
                                                      <option value="#payment_type_id#" <cfif getInvoiceData.payment_type_id EQ getPaymentTypes.payment_type_id>selected</cfif>>#payment_type_name#</option>
                                                </cfoutput>
                                          </select>
                                    </td>
                              </tr>
                        </cfif>
                        <cfif objUser.netSettlementCheck(objUser.getUserID()) EQ 1>
                              <tr>
                                    <td>
                                          Net Settlement?:
                                    </td>
                                    <td>
                                          <input type="Checkbox" name="net_settlement" id="net_settlement" <cfif getInvoiceData.net_settlement EQ "Y">checked</cfif> onClick="checkOther();">
                                    </td>
                              </tr>
                        </cfif>
                        <tr>
                              <td class="input" colspan=2>
                                    Description:
                              </td>
                        </tr>
                        <tr>
                              <td class="input" colspan=2>
                                    <textarea name="invoice_description" class="input" cols="40" rows="4" onblur="changeButtons();"><cfif getInvoiceData.invoice_description NEQ ""><cfoutput>#getInvoiceData.invoice_description#</cfoutput></cfif></textarea>
                              </td>
                        </tr>
                  </table>
            </td>            
      </tr>      
      <tr>
            <td><hr></td>
      </tr>
      <tr>
            <td valign="top">
                  <table cellspacing=0 cellpadding=0 width=100%>
                        <tr>
                              <td>
                                    <div id="vendor_detail" class="input"></div>
                              </td>
                        </tr>
                        <tr>
                              <td>
                                    <div id="vendor_hold" class="input"></div>
                              </td>
                        </tr>
                  </table>
            </td>
      </tr>
</table>
</form>
</div>
<div id="footer">
      <div id="toolbar">
            <table cellspacing=0 cellpadding=0 width=100%>
                  <tr>
                        <td>
                              <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');"
      onclick="submitForm();" src="images/approve_inv_disabled.gif" width="67" height="19" align="middle" alt="Approve Invoice" id="approve_submit">
                        </td>
                        <td>
                              <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');"
      onclick="denyInvoice();" src="images/deny_inv.gif" width="49" height="19" align="middle" alt="Deny Invoice">
                        </td>
                        <cfif URL.r eq "p">
                              <td>
                                    <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');"
            onclick="deleteInvoice();" src="images/delete_inv.gif" width="60" height="19" align="middle" alt="Delete Invoice">
                              </td>
                        <cfelseif URL.r EQ "a">
                              <td>
                                    <img class="toolbarButton" onmouseover="mouseover(this,'raised');" onmouseout="mouseout(this,'toolbarButton');" onmousedown="mousedown(this,'pressed');" onmouseup="mouseup(this,'raised');"
            onclick="overrideAmount();" src="images/override_amount.gif" width="67" height="19" align="middle" alt="Override Invoice Amount">
                              </td>
                        </cfif>
                  </tr>
            </table>
      </div>
</div>
</div>

<cfif getInvoiceData.vendor_site_id NEQ "">
      <cfquery name="getVendorInfo" datasource="xxxxx">
            Select v.vendor_name,vs.vendor_site_code,vs.address_line1,vs.address_line2,
               vs.city,vs.state,vs.zip,vs.area_code,vs.phone,vs.hold_all_payments_flag,
               vs.hold_future_payments_flag, vs.vendor_id, vs.vendor_site_id
            From po.po_vendor_sites_all vs, po.po_vendors v
            Where v.vendor_id=vs.vendor_id
            and vs.vendor_site_id=#getInvoiceData.vendor_site_id#
      </cfquery>
      <script>
            function initVendor(){
            <cfif getVendorInfo.hold_all_payments_flag EQ "N">
                  document.getElementById('vendor_hold').style.color="green";
                  document.getElementById('vendor_hold').innerHTML="Vendor is in good standing.";
            <cfelse>
                  document.getElementById('vendor_hold').style.color="red";
                  document.getElementById('vendor_hold').innerHTML="Vendor is in a HOLD state.";
            </cfif>
            var vendorData = "<cfoutput><b>#getVendorInfo.vendor_name#</b> - #getVendorInfo.vendor_site_code#<br>#getVendorInfo.address_line1#<br><cfif getVendorInfo.address_line2 NEQ "">#getVendorInfo.address_line2#<br></cfif>#getVendorInfo.city#, #getVendorInfo.state# #getVendorInfo.zip#</cfoutput>";
            document.getElementById('vendor_detail').innerHTML=vendorData;
            }
      </script>
      <script>initVendor();</script>
</cfif>
<cfif getInvoiceData.status_id EQ 7>
      <script>
            document.getElementById('vendor_detail').style.color="red";
            document.getElementById('vendor_detail').style.fontWeight="bold";
            document.getElementById('vendor_detail').innerHTML="Waiting for vendor setup";
            //document.getElementById('vendor_hold').innerHTML="Awaiting creation of vendor - <cfoutput>#getInvoiceData.vendor_needed#</cfoutput>";
      </script>
</cfif>
<cfif getInvoiceData.status_id EQ 8>
      <script>
            document.getElementById('vendor_detail').style.color="red";
            document.getElementById('vendor_detail').style.fontWeight="bold";
            document.getElementById('vendor_detail').innerHTML="Waiting for vendor address setup";
            document.getElementById('vendor_hold').innerHTML="<cfoutput>#getInvoiceData.vendor_name#</cfoutput>";
      </script>
</cfif>

<div id="invoicePDF">
      <iframe name="invPDF" src="http://<cfoutput>#cgi.server_name#/online_invoices/#URL.y#/#URL.i#.pdf</cfoutput>" class="invIframe" ></iframe>
</div>
<iframe width=132 height=142 name="gToday:contrast:agenda.js" id="gToday:contrast:agenda.js" src="scripts/popCal/inv_form/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
</body>
</html>


THANKS
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 17006754
Hi,
in the dialog box scripting page give
<HEAD>
        .......
              <base target="_self">
         ...
      </HEAD>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 18011519
I believe you are only allowed to have one showModal at a time
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18051496
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question