www.webdeveloper.com
Results 1 to 3 of 3

Thread: xmlhttrequest

  1. #1
    Join Date
    Nov 2013
    Posts
    7

    xmlhttrequest

    i have a code , is working with two drowdowns on sales and other currency
    when i change sales i want it to change currency to what it corresponds
    HTP.P('<td class="reqlabel1">Sales Center:</td>');
    HTP.P('<td class="tablelabel">');
    HTP.P(Get_Sc_Dd(PVNAME=>'pnSalesCenterID', PVORAID=> VUSERNAME, PVDEFVAL => NSALESCENTERID, PVEVENT=>'class="reqinput1" onChange="javascript:currencychange();" style="width:260px"'));
    ********************************
    Code:
      CURRDEF := get_criteria_rec('PROCURR_DEF',dml_p_oracle_user.get_rec(VUSERNAME).global_region).include_list;
        
           
        HTP.P( '<script> 
     function makeRequest(){
                ajaxReq = (window.XMLHttpRequest)? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP")
             
                ajaxReq.open("GET","contr_entry_pkg.select_sales_center?&pnSalesCenterID="document.getElementById("pnSalesCenterID")+ "&pvCurrCd="document.getElementById("'||CURRDEF||'"),true);
                ajaxReq.onreadystatechange =currencychange; 
                document.getElementById("updateLabel").innerHTML = ""
                ajaxReq.send()         
            } 
            function currencychange(){
    
                if(ajaxReq.readyState == 4){
                    if(ajaxReq.status == 200){
                     //var resultsJSON = eval(''('' + ajaxReq.responseText + '')'');
                        document.getElementById("updatelabel").innerHTML = ajaxReq.responseText               
                    }
               
                }
            }');
         HTP.P( '</script>');         
           --
            HTP.P('<td class="reqlabel1">Currency:</td>');
            HTP.P('<td class="tablelabel">');
    
             HTP.P(Get_currencyCode_Dd(PVNAME=>'pvCurrCd', 
             PVDEFVAL =>NULL,    
             PVEVENT=>'class="reqinput1"onBlur="currencychange();" style="width:200px"'));
           HTP.P('</td>');
    ************
    im not sure if im doing it right , since is my first time, but is not working.using firebug i get
    currencychange is not defined, i do not know if ajaxReq.open is correct

    the way it suppose to work if when i choose a sales center form pnsalescenterid, it should give me a
    currency change, by default currency is null. any help will be appreciated

  2. #2
    Join Date
    Nov 2013
    Posts
    7

    i edit

    [QUOTE=nataliafoster26;1294809]i have a code , is working with two drowdowns on sales and other currency
    when i change sales i want it to change currency to what it corresponds
    HTP.P('<td class="reqlabel1">Sales Center:</td>');
    HTP.P('<td class="tablelabel">');
    HTP.P(Get_Sc_Dd(PVNAME=>'pnSalesCenterID', PVORAID=> VUSERNAME, PVDEFVAL => NSALESCENTERID, PVEVENT=>'class="reqinput1" onChange="javascript:currencychange();" style="width:260px"'));
    ********************************
    Code:
      CURRDEF := get_criteria_rec('PROCURR_DEF',dml_p_oracle_user.get_rec(VUSERNAME).global_region).include_list;
        
           
      HTP.P( '<script> 
     function makeRequest(pnSalesCenterID){
                ajaxReq = (window.XMLHttpRequest)? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP")
             
                ajaxReq.open("POST","contr_entry_pkg.sales_center_dropdown?&pnSalesCenterID="document.getElementById("pnSalesCenterID")+ "&pvCurrCd="document.getElementById("'||CURRDEF||'"),true);
                ajaxReq.onreadystatechange =function()currencychange; 
             
                ajaxReq.send()         
            } 
            function currencychange(){
    
                if(ajaxReq.readyState == 4){
                    if(ajaxReq.status == 200){
                     //var resultsJSON = eval(''('' + ajaxReq.responseText + '')'');
                        document.getElementById("pvCurrCd").innerHTML = ajaxReq.responseText;  
                                
                    }
               
                }
            }');
         HTP.P( '</script>');
    ************
    im not sure if im doing it right , since is my first time, but is not working.using firebug i get
    currencychange is not defined, i do not know if ajaxReq.open is correct

    the way it suppose to work if when i choose a sales center form pnsalescenterid, it should give me a
    currency change, by default currency is null. any help will be appreciated
    i edit some stuff

  3. #3
    Join Date
    Nov 2013
    Posts
    7
    when i use firebug i get.. ReferenceError: makeRequest is not defined

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles