Using ajax to submit a request to asp

I'm currently using the onbeforeunload event in the body tag to run a function when the window is closed. at that point it runs an ajax function to submit a "logout" time for the application.
However, this works perfectly fine in Firefox and IE(on both mac and PC). It will get to the function, but then doesn't seem to want to run the asp page(which basically just puts in the time for the current user).
I'm not sure what I'm doing wrong:
function GetXmlHttpObject() {
var objXMLHttp = null;
if (window.XMLHttpRequest) {
objXMLHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert("Please use IE6(or greater),Firefox, or new verion of safari");
return objXMLHttp;
} // End of function
function doUnload()
var xhr;
//this
xhr=GetXmlHttpObject();
url="../admin/logoff-actions-BBLT.asp";
xhr.open("POST",url,true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(null);
//alert("closing up the window");
</script>

(which basically just puts in the time for the current user).
What format is the date and time, bob? Apparently Safari has some trouble interpreting certain date and time formats in some circumstances. See:
http://discussions.apple.com/message.jspa?messageID=10740462#10740462

Similar Messages

  • Submit page item using AJAX

    Hi All,
    Thanks for any help in advance.
    I am trying to submit an item into the session by using AJAX iin version 4.1
    I have a application process which is an on demand: run this application process when requested by a page process.
    begin
      :P4_FISCAL_YEAR2 := :AJAX_4_FISCAL_YEAR2;
    end;then in the item :P4_FISCAL_YEAR2 have the html form element attributes set to:
    (also the page item is set to None(Default) on page action when value changed.
    onchange="selectChanged6(this)"and a page process
    <script type="text/javascript">
    function selectChanged6(filter)
    var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=SET_4_FISCAL_YEAR2',0);
    get.add('AJAX_4_FISCAL_YEAR2', filter.value);
    var ret = get.get();
    </script>The item doesnt seem to be submitting into the session and I cant figure out why, Thanks

    Marie,
    I think I have acomplished what you are looking for but if your goal is quick response time then this can fluctuate since there is 1 ajax call made to set your item value and another ajax call for every chart you want to refresh.
    This solution assumes the following:
    1. all reports are in the same language and in english.
    2. all reports are flash charts.
    here is a demo: http://apex.oracle.com/pls/apex/f?p=43401:23:0
    Go into your chart template and add the class refreshable_chart
    <div class="rounded-corner-region refreshable_chart" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>
    ...Create the following dynamic action on your chart page:
    Name: refresh_chart
    Event: Change
    Selection Type: Item(s)
    Item(s): P4_FISCAL_YEAR2
    True actions:
    Sequence: 10
    Action: execute pl/sql code
    Code:
    NULL;
    {code}
    Page Items to Submit: P4_FISCAL_YEAR2
    Sequence: 20
    Action: Execute JavaScript code
    Affected Elements:
    -- Type: jQuery Selector
    -- jQuery Selector: .refreshable_chart
    Code:
    {code:javascript}
    this.affectedElements.each(function(){
      apex_RefreshFlashChart(&APP_PAGE_ID., this.id.substr(1), 'en');
    {code}
    Good Luck,
    Tyson Jouglet
    Edited by: Tyson Jouglet on Dec 14, 2011 10:33 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can i upload file using ajax post request and jsp

    Hi
    this is my code files
    addPhoto.jsp
    <html>
    <head>
    <title>Add Photo</title>
    <script>
    var optionNo = 0;
    var i=1;
    var val=0;
    var file = 0;
    var exten = new Array(".jpg",".jpeg",".gif");
    function addValues()
         for(var i=0;i<5;i++)
              optionNo += 1;
              oNewOption = new Option();
              oNewOption.text = optionNo;
              oNewOption.value = optionNo;
              addSelect.add(oNewOption);
    function addBoxes()
         var str = "";
         var j=0;
         val = document.getElementById('addSelect').value;
         for(j=1; j<= val; j++)
              str = str + '<font size=3>file:' + j + '</font>';
              str = str + '<input type="file" id=filepath'+ j +' name=file'+ j + ' onchange="uploadFile(hidden'+ j + '.value)"><div id="result'+ j +'"></div>
              str = str + '<input type="hidden" name="hidden' + j + '" value=' + j +'>';
         document.getElementById('addPhoto').innerHTML = str;
    function uploadFile(value)
    var str = "filepath" + value;
    file = value;
    var param = document.getElementById(str).value;
    var parameter = "filepath=" + param;
    alert(parameter.length);
    if(checkValidity(param))
    var url = "uploadFile.jsp";
    if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    req.open("POST", url, true);
    req.setRequestHeader("Content-type", "multipart/form-data");
    //req.setRequestHeader("Content-length", parameter.length);
    req.setRequestHeader("Connection", "close");
    req.onreadystatechange = callback;
    req.send(null);
         else
              document.getElementById("result" + file).innerHTML = "upload .jpeg,.jpg,.gif Files Only";
    function callback() {
    if (req.readyState == 4) {
    updatepage(req.responseText);
    function updatepage(str){
         document.getElementById("result" + file).innerHTML = str;
    function checkValidity(str)
         var i=0;
         var j=0;
         var str1 = str.substring(str.lastIndexOf("."),str.length);
         alert(str1);
         for(i=0;i<exten.length;i++)
         if(str1.search(exten) != -1)
              j++;
              break;
         if(j>0)
              return true;
         else
              return false;
    </script>
    </head>
    <body onload="addValues()">
    <h5>Add Photo(s)</h5>
    <select id="addSelect" name="addSelect" onchange="addBoxes()">
    <option id="select" selected>Select</option>
    </select>
    <div id="addPhoto"></div>
    </body>
    </html>
    uploadFile.jsp
    <%@page import="java.io.*"%>
    <%
    /*try
    String contentType = request.getContentType();
         System.out.println(request.getMethod());
         System.out.println("Content type is :: " +contentType); 
         if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
              DataInputStream in = new DataInputStream(request.getInputStream());
              DataInputStream in1 = in;
              int formDataLength = request.getContentLength();
    System.out.println(formDataLength);
              byte dataBytes[] = new byte[formDataLength];
              int byteRead = 0;
              int totalBytesRead = 0;
              while (totalBytesRead < formDataLength)
                   byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
                   totalBytesRead += byteRead;
              out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
         } catch(Exception e) {
              e.printStackTrace();
         try
         String filePath = request.getParameter("filepath");
         System.out.println(filePath);
         File f= new File(filePath);
         String path = f.getName();
         String contentType = request.getContentType();
         System.out.println(contentType);
         //InputStream in = new FileInputStream(filePath);
         DataInputStream in = new DataInputStream(request.getInputStream());
         int formDataLength = request.getContentLength();
         System.out.println(formDataLength);
    byte[] buf = new byte[1024];
    OutputStream out1 = new FileOutputStream("c:/docs/" + path);
    int len;
    while ((len = in.read(buf)) > 0) {
    out1.write(buf, 0, len);
    in.close();
    out1.close();
         out.write("File Uploaded SucssesFully");
    catch(Exception e)
         e.printStackTrace();
         out.write("error while Writing File");
    %>
    the above code in request.getContentType() i am getting 0. I am not passing the content length. for the same application with out using Ajax i am
    getting the size of file... it is very very urgent for me.. pls help me out on this...
    Any one having the code on this pls mail me the code...
    my mail id ... [email protected]
    Regards
    Ashok Kumar

    Sure, you can upload a file, using a form input element of type file. You pick this up with a servlet, though you need a special request wrapper to sort out the multi-part request you get back that way (there's a suitable package on jakarta.apache.org/commons)
    The servlet decrypts the file and can pass the results to a JSP for display.
    Don't try to do the complicated stuff in a JSP, it all gets incredibly messy, and that's not what JSPs are for.

  • Request and response using Ajax...

    Hi' does anyone know how to get 2 or more response if using ajax? (let's say that it's more than 1 response).
    cos XMLHttpRequest only can retrieve for one response at time. does anyone know how to solve this?
    Thanks a lot....

    what i mean like this, i have a multiply function in my jsp, code like this :
    <%
        String a = request.getParameter("a");
        String b = request.getParameter("b");
        total = ( (Integer.parseInt(a))*(Integer.parseInt(b)) );
        out.println(total);
        out.println("hello");
    %>it prints total and hello.
    How to handle it in my javascript? ajax just handle the response with xmlHttp.responseText. So all the output are handle in only in xmlHttp.responseText). how to make my ajax can receive 2 output from server seperately?
    Thanks...
    Btw this is my ajax source :
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <html>
         <head>
              <title>Ajax Multiply Example</title>
              <script language="Javascript">
                 xmlHttp = null;
                   function postRequest(strURL){
                        if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
                             xmlHttp = new XMLHttpRequest();
                        else if(window.ActiveXObject){ // For Internet Explorer
                             xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                        xmlHttp.open('POST', strURL, true);
                        xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        xmlHttp.onreadystatechange = function(){
                             if (xmlHttp.readyState == 4){
                                 //alert(xmlHttp.responseText);
                                 updatepage(xmlHttp.responseText);                           
                        xmlHttp.send(strURL);
                   function updatepage(str){
    //i don't know how to modify in this.can anyone help?
                        document.getElementById('result').value = str;
                        document.getElementById('helloField').value = str;                        
                   function callMultiply(){
                        var a = parseInt(document.f1.a.value);
                        var b = parseInt(document.f1.b.value);
                        var url = "multiply.jsp?a=" + a + "&b=" + b + "";
                        postRequest(url);
              </script>
         </head>
         <body>
              <h1 align="center"><font color="#000080">Ajax Example</font></h1>
              <form name="f1">
                   <input name="a" id="a" value="">
                   <input name="b" id="b" value="">
                   <input name="result" type="text" id="result">
                   <input name="helloField" type="text" id="helloField">
                   <input type="button" value="Multiply" onClick="callMultiply()" name="showmultiply">
              </form>
         </body>
    </html>

  • Can I submit pl/sql process using AJAX?

    Can i submit process using ajax?
    Thanks

    Hello,
    Please tell us your first name, and change your forum handle to something friendlier than user123… It’s easier for us that way.
    >> Can i submit process using ajax?
    The server side of AJAX allows you to invoke an APEX on-demand PL/SQL process (which is actually a PL/SQL anonymous block) or any stored procedure on the database.
    The following is a good place to start understanding APEX AJAX - http://htmldb.oracle.com/pls/otn/f?p=11933:63 .
    Regards,
    Arie.
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • Uploading a file to server using ajax and struts

    My problem is i wrote a program to upload a file to the server using Ajax.
    Here iam used Struts and Ajax.
    The problem is when iam uploaded a file from my PC the file is uploading to the server in the upload folder located in the server my system.
    Iam using Tomcat server 5.0
    But when iam trying to access it through other system it is not doing so
    Giving an internal server error i,e 500.
    Iam putting the necessary documents for ur reference.
    Plz help me soon .
    My exact requirement is i have to upload a file to the upload folder located in the server.
    And i have to get the path of that file and display the file path exactly below the browse button from where iam uploaded a file.
    That should be done without page refresh and submit thats y iam used Ajax
    Any help would greatly appreciated
    Thanks and Regards
    Meerasaaheb.
    The action class is FilePathAction
    package actions;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    public class FilePathAction extends Action{
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    String contextPath1 = "";
    String uploadDirName="";
    String filepath="";
    System.out.println(contextPath1 );
    String inputfile = request.getParameter("filepath");
    uploadDirName = getServlet().getServletContext().getRealPath("/upload");
    File f=new File(inputfile);
    FileInputStream fis=null;
    FileOutputStream fo=null;
    File f1=new File(uploadDirName+"/"+f.getName());
    fis=new FileInputStream(f);
    fo=new FileOutputStream(f1);
    try
    byte buf[] = new byte[1024*8]; /* declare a 8kB buffer */
    int len = -1;
    while((len = fis.read(buf)) != -1)
    fo.write(buf, 0, len);
    catch(Exception e)
    e.printStackTrace();
    filepath=f1.getAbsolutePath();
    request.setAttribute("filepath", filepath);
    return mapping.findForward("filepath");
    the input jsp is
    filename.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script type="text/javascript">
    alertflag = false;
    var xmlHttp;
    function startRequest()
    if(alertflag)
    alert("meera");
    xmlHttp=createXmlHttpRequest();
    var inputfile=document.getElementById("filepath").value;
    xmlHttp.open("POST","FilePathAction.do",true);
    xmlHttp.onreadystatechange=handleStateChange;
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttp.send("filepath="+inputfile);
    function createXmlHttpRequest()
    //For IE
    if(window.ActiveXObject)
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    //otherthan IE
    else if(window.XMLHttpRequest)
    xmlHttp=new XMLHttpRequest();
    return xmlHttp;
    //Next is the function that sets up the communication with the server.
    //This function also registers the callback handler, which is handleStateChange. Next is the code for the handler.
    function handleStateChange()
    var message=" ";
    if(xmlHttp.readyState==4)
    if(alertflag)
    alert(xmlHttp.status);
    if(xmlHttp.status==200)
    if(alertflag)
    alert("here");
    document.getElementById("div1").style.visibility = "visible";
    var results=xmlHttp.responseText;
    document.getElementById('div1').innerHTML = results;
    else
    alert("Error loading page"+xmlHttp.status+":"+xmlHttp.statusText);
    </script></head><body><form name="thumbs" enctype="multipart/form-data" method="post" action="">
    <input type="file" name="filepath" id="filepath" onchange="startRequest();"/>
    </form>
    <div id="div1" style="visibility:hidden;">
    </div></body></html>
    The ajax response is catching in a dummy.jsp
    <%=(String)request.getAttribute("filepath")%>
    corresponding action mapping
    <action path="/FilePathAction" type="actions.FilePathAction">
    <forward name="filepath" path="/dummy.jsp"/>
    </action>
    So plz help me to upload a file to the server from any PC.
    Iam searched alot but didnt get any solution.

    Plz help me soon if it possible so
    Iam in great need.
    I have worked alot but not worked out.
    Any help greatly appreciated

  • Display variable using ajax

    I want to display username entered in textbox of html page after clicking on submit button, the username should get displayed on different html page generated by servlet using AJAX.I have written the following code but it is not working properly. instead of username entered it shows output as: null
    Please help me to know what mistake i am comitting.
    CODE FOR SERVLET_
    String userName=request.getParameter("userN");
              out.print(userName);
    CODE FOR JSP PAGE_
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <script language="Javascript">
      function check() {
           var req;
           var userN;
           var pass;
           if (window.XMLHttpRequest) {
               req=new XMLHttpRequest();
           } else if (window.ActiveXObject) {
               req= new ActiveXObject("Microsoft.XMLHTTP");
          userN = document.getElementById("userN").value;
          pass = document.getElementById("pass").value;
         var url = "checkServlet?userN="+userN+"&pass="+pass;
           req.open("GET", url, true);
           req.send(null);
    </script>
            <title>Login Page</title>
        </head>
        <body>
            <a href="index.jsp">Home</a><%out.print("\t");%><a href="faq.jsp">Q&A</a>
         <form action="checkServlet" method="POST"><center><table border="1">
                    <tbody>
                        <tr>
                            <td>Username</td>
                            <td><input id="userN" type="text" name="username" value="" /></td>
                        </tr>
                        <tr>
                            <td><input type="reset" value="Reset" name="reset" /></td>
                            <td><input type="submit"  onclick="check();" value="Submit" name="process" /></td>
                        </tr>
                    </tbody>
                </table><center>
                              </form >
               </body>
    </html>

    i forgot to mention that in the code.
    there is also following code of "pass" id
      <tr>
                            <td>Password</td>
                            <td><input id="pass" type="password" name="password" value="" /></td>
                        </tr>Now please help me to know why servlet is not displaying variables.

  • How to use Ajax Get Multiple Values in Tabular form?

    Hi All-
    I am trying to use AJAX to get multiple values in tabular form by using Denes Kubicek's example in the following link -
    http://apex.oracle.com/pls/otn/f?p=31517:239:9172467565606::NO:::
    Basically, I want to use the drop down list to populate rest of the values on the form.
    I have created the example(Ajax Get Multiple Values, application 54522) on Oracle site -
    http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::
    Workspace: iConnect
    login: demo
    password: demo
    I was able to duplicate his example on page 1 (home page).
    However, I want to use system generate tabular form to finish this example, and was not able to populate the data correctly.
    Page 2 (method 2) is the one that I am having trouble to populate the column values. When I checked application item values in Session, and the values seems to be populated correctly.
    This is what I have done on this page:
    1. Create an Application Process On Demand - Set_Multi_Items_Tabular2:
    DECLARE
      v_subject my_book_store.subject%TYPE;
      v_price my_book_store.price%TYPE;
      v_author my_book_store.author%TYPE;
      v_qty NUMBER;
      CURSOR cur_c
      IS
      SELECT subject, price, author, 1 qty
      FROM my_book_store
      WHERE book_id = :temporary_application_item2;
    BEGIN
      FOR c IN cur_c
      LOOP
      v_subject := c.subject;
      v_price := c.price;
      v_author := c.author;
      v_qty := c.qty;
      END LOOP;
      OWA_UTIL.mime_header ('text/xml', FALSE);
      HTP.p ('Cache-Control: no-cache');
      HTP.p ('Pragma: no-cache');
      OWA_UTIL.http_header_close;
      HTP.prn ('<body>');
      HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
      HTP.prn ('<item id="f04_' || :t_rownum || '">' || v_subject || '</item>');
      HTP.prn ('<item id="f05_' || :t_rownum || '">' || v_price || '</item>');
      HTP.prn ('<item id="f06_' || :t_rownum || '">' || v_author || '</item>');
      HTP.prn ('<item id="f07_' || :t_rownum || '">' || v_qty || '</item>');
      HTP.prn ('</body>');
    END;
    2. Create two application items - TEMPORARY_APPLICATION_ITEM2, T_ROWNUM2
    3. Put the following in the Page Header:
    <script language="JavaScript" type="text/javascript">
    function f_set_multi_items_tabular2(pValue, pRow){
        var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Set_Multi_Items_Tabular2',0);
    if(pValue){
    get.add('TEMPORARY_APPLICATION_ITEM2',pValue)
    get.add('T_ROWNUM2',pRow)
    }else{
    get.add('TEMPORARY_APPLICATION_ITEM2','null')
        gReturn = get.get('XML');
        if(gReturn){
            var l_Count = gReturn.getElementsByTagName("item").length;
            for(var i = 0;i<l_Count;i++){
                var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
                var l_ID = l_Opt_Xml.getAttribute('id');
                var l_El = html_GetElement(l_ID);   
                if(l_Opt_Xml.firstChild){
                    var l_Value = l_Opt_Xml.firstChild.nodeValue;
                }else{
                    var l_Value = '';
                if(l_El){
                    if(l_El.tagName == 'INPUT'){
                        l_El.value = l_Value;
                    }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
                        l_El.parentNode.innerHTML = l_Value;
                        l_El.parentNode.id = l_ID;
                    }else{
                        l_El.innerHTML = l_Value;
        get = null;
    </script>
    Add the follwing to the end of the above JavaScript:
    <script language="JavaScript" type="text/javascript">
    function setLOV(filter, list2)
    var s = filter.id;
    var item = s.substring(3,8);
    var field2 = list2 + item;
    f_set_multi_items_tabular2(filter, field2);
    4. Tabular form query:
    select
    "BOOK_ID",
    "BOOK",
    "SUBJECT",
    "PRICE",
    "AUTHOR",
    "QTY",
    "BOOK_ID" BOOK_ID_DISPLAY
    from "#OWNER#"."MY_BOOK_STORE"
    5. In Book_ID_DISPLAY column attribute:
    Add the following code to element attributes: onchange="javascript:f_set_multi_items_tabular2(this.value,'#ROWNUM#');"
    Changed to -> onchange="javascript:setLOV(this,'f03');"
    Now,  T_ROWNUM2 returns value as f03_0001. But, TEMPORARY_APPLICATION_ITEM2 returns as [object HTMLSelectElement]...
    Please help me to see how I can populate the data with this tabular form format. Thanks a lot in advanced!!!
    Ling
    Updated code in Red..

    Ling
    Lets start with looking at what the javascript code is doing.
    function f_set_multi_items_tabular(pValue, pRow){
      /*This will initiate the url for the demand process to run*/
      var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
                              'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
      if(pValue){
        /*If there is an value than submit item name with value*/
        get.add('TEMPORARY_APPLICATION_ITEM',pValue)
        get.add('T_ROWNUM',pRow)
      }else{
        /*Else set the item TEMPORARY_APPLICATION_ITEM to null*/
        get.add('TEMPORARY_APPLICATION_ITEM','null')
      /*Submit the url and te returned document is of type XML*/
      gReturn = get.get('XML');
      if(gReturn){
        /*There is something returned*/
        var l_Count = gReturn.getElementsByTagName("item").length;
        /*For all elements of the tag item*/
        for(var i = 0;i<l_Count;i++){
          /*Get the item out of the XML*/
          var l_Opt_Xml = gReturn.getElementsByTagName("item")[i];
          /*Get the id of the item*/
          var l_ID = l_Opt_Xml.getAttribute('id');
          /*Get the element in the original page with the same id as
          **the item we have in the XML produced by the ondemand process
          var l_El = html_GetElement(l_ID);
          /*Now get the value of the item form the XML*/
          if(l_Opt_Xml.firstChild){
            var l_Value = l_Opt_Xml.firstChild.nodeValue;
          }else{
            /*There is no value*/
            var l_Value = '';
          if(l_El){
            /*There is an element with the same id as the item we are processing*/
            if(l_El.tagName == 'INPUT'){
              /*The element is an input item just set the value*/
              l_El.value = l_Value;
            }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
              /*If it is a span elment and has the class grabber
              **Then set the innerHTML of the parent to the value
              **and the id of the parent to the id
              l_El.parentNode.innerHTML = l_Value;
              l_El.parentNode.id = l_ID;
            }else{
              /*Else set the value as innerHTML*/
              l_El.innerHTML = l_Value;
      get = null;
    Now where it went wrong in your initial post
    The XML that was returned by your XML process would be something like
    <body>
      <desc>this xml genericly sets multiple items</desc>
      <item id="f02_1">CSS Mastery</item>
      <item id="f03_1">22</item>
      <item id="f04_1">Andy Budd</item>
      <item id="f05_1">1</item>
    </body>
    When you don't use apex_item to create your tabular form a item in the table will look like
    <input id="f02_0001" type="text" value="CSS Mastery" maxlength="2000" size="16" name="f05" autocomplete="off">
    Notice the id's f02_1 and f02_0001 don't match.
    So to make it work the XML would have to look like
    <body>
      <desc>this xml genericly sets multiple items</desc>
      <item id="f02_0001">CSS Mastery</item>
      <item id="f03_0001">22</item>
      <item id="f04_0001">Andy Budd</item>
      <item id="f05_0001">1</item>
    </body>
    To do that simply use lpad in the ondemand process like
    HTP.prn ('<item id="f02_' || lpad(:t_rownum,4,'0') || '">' || v_subject || '</item>');
    HTP.prn ('<item id="f03_' || lpad(:t_rownum,4,'0') || '">' || v_price || '</item>');
    HTP.prn ('<item id="f04_' || lpad(:t_rownum,4,'0') || '">' || v_author || '</item>');
    HTP.prn ('<item id="f05_' || lpad(:t_rownum,4,'0') || '">' || v_qty || '</item>');
    Keep in mind that the above is based on your original post and #ROWNUM# not being lpadded with zero's.
    Nicolette

  • Error processing a page when using AJAX

    hi apex forum.
    I need your help with a problem that presents me with an application in apex 4.2.
    I have developed a html screen, in which I have created a table that contains a detailed items and on which the user can enter some values. these data that user enters, I calculate a total at the end of the page. To view the current total of the entries , the user presses a button that uses AJAX (to avoid having to refresh the whole page)  to calculate totals and at the same time, i call an AJAX process to add each record to an apex_collection , until here everything perfect.
    The problem is that when I want to save the information to pass it from apex_collection to the database (by pressing a button and make the official insert), I must first have to refresh the page, if not do it this way, Apex generate an Error Message.
    it's important to say that error does not apper, if before pressing the button, i first refresh the page.  Any suggestions??
    I think I should use some internally command to synchronize or update the page.... any suggestions are welcome.,
    thanks in advance,

    Soooo...
    What is the error you are seeing?
    Is the multi-row process still there? What exactly happens on submit (computations, validations, processes)?
    Have you tried to run with debug enabled and were you able to see where the error originates?

  • Getting an error while trying to use AJAX servlet in EP

    Hi All,
      This is my first time trying to develop a PAR file using AJAX. I have a project called NonEmployee and in it there is a class called NonEmployeeHiring which extends AbstractPortalComponent. I am trying to use AJAX, so that when users select a position from a drop down on the JSP, it send the request to a servlet called PositionDetailServlet, which does the processing and sens response back. However, I am getting a very weird error back in the response from servlet. Seems like it does not make upto the servlet and a part of the error that i am getting says,
    No security zone - access is denied
    com.sap.portal.system/applications/NonEmployee/components/PositionDetailServlet
    This is only a part of the big page of error. My servlet is in src.core folder. Here is my portalapp.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <application>
      <application-config>
        <property name="startup" value="true"/>
        <property name="ServicesReference" value="com.sap.portal.ivs.iviewservice,com.sap.portal.ivs.connectorservice,com.sap.portal.runtime.system.inqmy,com.sap.portal.pcd.glservice,com.sap.portal.ivs.systemlandscapeservice,com.sap.portal.pcmbuilderservice,usermanagement,com.sap.portal.ivs.logger,com.sap.portal.usermapping,landscape,jcoclient"/>
         <property name="SharingReference" value="urlgenerator"/>
      </application-config>
      <application-config>
         <property name="SharingReference" value="urlgenerator"/>
      </application-config>
      <components>
        <component name="NonEmployeeHiring">
          <component-config>
            <property name="ClassName" value="NonEmployeeHiring"/>
            <property name="SecurityZone" value="low_safety"/>
          </component-config>
          <component-profile>       
            <property name="SystemIdentifier" value="SAP_R3_HumanResources"/>
            <property name="groupSubGroupForSalTypeValidation" value="A,01,AS,A,02,AS,A,03,HR,A,04,AS,A,05,HR,A,06,HR,A,07,HR,B,03,HR,B,04,AS,B,05,HR,B,06,HR,B,07,HR"/>
          </component-profile>
        </component>
        <component name="PositionDetailServlet">
             <component-config>
                 <property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet"/>
                 <property name="ComponentType" value="servlet"/>
               </component-config>
        </component>  </components>
      <services/>
    </application>
    Any help will be greatly appreciated.
    Thanks in advance,
    Preet

    Thanks a lot for replying and trying to help me guys. Here is what my new portalapp.xml looks like
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <application>
      <application-config>
        <property name="startup" value="true"/>
        <property name="ServicesReference" value="com.sap.portal.ivs.iviewservice,com.sap.portal.ivs.connectorservice,com.sap.portal.runtime.system.inqmy,com.sap.portal.pcd.glservice,com.sap.portal.ivs.systemlandscapeservice,com.sap.portal.pcmbuilderservice,usermanagement,com.sap.portal.ivs.logger,com.sap.portal.usermapping,landscape,jcoclient"/>
         <property name="SharingReference" value="urlgenerator"/>
      </application-config>
      <application-config>
         <property name="SharingReference" value="urlgenerator"/>
      </application-config>
      <components>
        <component name="NonEmployeeHiring">
          <component-config>
            <property name="ClassName" value="NonEmployeeHiring"/>
            <property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
          </component-config>
          <component-profile>       
            <property name="SystemIdentifier" value="SAP_R3_HumanResources"/>
            <property name="groupSubGroupForSalTypeValidation" value="A,01,AS,A,02,AS,A,03,HR,A,04,AS,A,05,HR,A,06,HR,A,07,HR,B,03,HR,B,04,AS,B,05,HR,B,06,HR,B,07,HR"/>
          </component-profile>
        </component>
        <component name="PositionDetailServlet">
             <component-config>
                 <property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet"/>
                 <property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
                 <property name="ComponentType" value="servlet"/>
               </component-config>
        </component>
        <component name="PositionDetailServlet1">
             <component-config>
                 <property name="ClassName" value="com.grainger.portal.servlets.PositionDetailServlet1"/>
                 <property name="SecurityZone" value="com.sap.portal.pdk/low_safety"/>
                 <property name="ComponentType" value="servlet"/>
               </component-config>
        </component>
      </components>
      <services/>
    </application>
    I created a new servlet called PositionDetailServlet1 and put it in src.api folder, thinking that that might help. But no luck at all. I am wondering if tehre is a global setting on the server for it to allow servlets to run. Just my guess.
    Any help will be greatly appreciated. That is no issue.
    Thanks,
    Preet

  • Error while trying to submit Access request to GRC from IDM

    Hello
    We have SAP IDM 7.2 SP8 installed and done all the prerequisite for connecting to GRC AC 10 as in configuration document.
    We are trying to submit request to GRC using Standard GRC provisioning framework task ( AC Validation) but pass: Submit AC Request fails with error: "Pass stopped by script"
    Is there anything wrong with the script which put RoleData details since its getting aborted ?
    I tried providing Role name directly in Role data attribute inside the action task and got following error:
    Error
    putNextEntry failed
    storingcn=IDMUSR0023,ou=useraccessrequest,o=grc
    Exception from Add operation:javax.naming.NamingException: [LDAP: error code
    82 - (GRC User Access Request:82:Script execution failed)]; remaining name
    'cn=IDMUSR0023,ou=useraccessrequest,o=grc'
    I checked VDS Logs and there was one error :
    Additional message = msgcode=4;msgdescription=Mandatory field ITEM NAME  is empty in line no 1 ;msgtype=ERROR
    From where exactly ITEM NAME field value will be fetched and pass to GRC for request creation ?
    Regards
    Deepak Gupta

    Thanks Christopher
    I got my issue fixed, There was issue with my GRC Initial load job which couldn't enrich repository privileges and hence the issue was coming since script wasn't able to find GRC ROLE ID and Application ID attribute from privileges.
    Regards
    Deepak Gupta

  • Help required for using ajax in netweaver

    Hi..
    Can i Use Ajax for my netweaver applications?? If yes, then how?? Any pointers regarding that will be adequately rewarded points..
    Thanks

    For pure JavaScript enabled AJAX application, no problem. You just write the application as usual and send XMLHttpRequest with parameters to server, then update the web page with your JavaScript code;
    I can show you some sample code here:
    <script type="text/javascript">
            function createXMLHttpRequest() {
                 var xmlHttp;
                if (window.ActiveXObject) {
                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                else if (window.XMLHttpRequest) {
                        xmlHttp = new XMLHttpRequest();
                return xmlHttp;
            function onclick_changeModelHouse(id) {
                var xmlHttp = createXMLHttpRequest();
                xmlHttp.onreadystatechange = function(){
                     if(xmlHttp.readyState == 4) {
                          if(xmlHttp.status == 200) {
                               // here you get your page component with id or any you like,
                                    // then update it with data returned from the request you sent;
                                   // Here I update one image url path;
                                  var img = document.getElementById("houseModel");
                                   // suppose you return the image file name;
                         img.innerHTML="<img src='images/" + xmlHttp.responseText +  "'>";
                xmlHttp.open("GET", "http://myserver:8080/myApp//AjaxImageService?model="+id, true);
                xmlHttp.send(null);
    </Script>
    For some button in your page you add javascript code like
    onClick="onclick_changeModelHouse(id)"
    somthing.
    You need develop servlet to response your request, and usually you need pass back your data in XML format, here I just use plain text for easy understanding.

  • How to make a link submit a request to a servlet

    I tried to submit a request to a server using a link,and get the paramer value which is dvd when the link is clicked but it returns null
    <form name = "myForm" method = "POST" action = "servlet1">
        < input type = "hidden" name = "param1" value = "dvd"/>
        <a href = "document.myForm.submit()">DVD</a>
    </form>
    form handler
    Under the servlet post method   i put the following code
    String  myVal = request.getParameter("param1");
    out.println("<html>");
    out.println("<head><title>wwwwwww</title></head>");
    out.println("<body>");
    out.println("<p>"+myVal+"</p>");
    out.println("</body>");
    out.println("</html>");

    change the link to
    <a href="javascript://" onClick="document.myForm.submit(); return false;">DVD</a>See if that helps. Don't forget the "return false" part!

  • # of parameters you can pass using AJAX

    I have a weird problem with an AJAX form combined with a CFC.  Just to rule out any possibilities, is there a limit on the number of input fields you can pass to a CFC using AJAX?  I only ask because it appears when the entire form is filled out the page throws an error that the CFC can't be found.
    Also, I'm noticing that 2 of the parameters are out of order (in red). Would that make a difference?  I'm also not sure why they are out of order when getting passed because they are not that way on the form.  Am I missing something here?
    CFC
    <cffunction name="LyricOpera" access="remote" returntype="array" output="false">
        <cfargument name="CurrentApplicationStep" type="string" default="" />
        <cfargument name="ScreenSelection" type="string" default="" />
        <cfargument name="Role1" type="string" default="" />
        <cfargument name="Opera1" type="string" default="" />
        <cfargument name="Company1" type="string" default="" />
        <cfargument name="Year1" type="string" default="" />
        <cfargument name="Role2" type="string" default="" />
        <cfargument name="Opera2" type="string" default="" />
        <cfargument name="Company2" type="string" default="" />
        <cfargument name="Year2" type="string" default="" />
        <cfargument name="Role3" type="string" default="" />
        <cfargument name="Opera3" type="string" default="" />
        <cfargument name="Company3" type="string" default="" />
        <cfargument name="Year3" type="string" default="" />
        <cfargument name="Aria1" type="string" default="" />
        <cfargument name="Aria1Opera" type="string" default="" />
        <cfargument name="Aria1Language" type="string" default="" />
        <cfargument name="Aria2" type="string" default="" />
        <cfargument name="Aria2Opera" type="string" default="" />
        <cfargument name="Aria2Language" type="string" default="" />
        <cfargument name="Aria3" type="string" default="" />
        <cfargument name="Aria3Opera" type="string" default="" />
        <cfargument name="Aria3Language" type="string" default="" />
        <cfargument name="Variable1Name" type="string" default="" />
        <cfargument name="Variable1Institution" type="string" default="" />
        <cfargument name="Variable1Address1" type="string" default="" />
        <cfargument name="Variable1City" type="string" default="" />
        <cfargument name="Variable1State" type="string" default="" />
        <cfargument name="Variable1Province" type="string" default="" />
        <cfargument name="Variable1Zipcode" type="string" default="" />
        <cfargument name="Variable1PostalCode" type="string" default="" />
        <cfargument name="Variable1Phone" type="string" default="" />
        <cfargument name="Variable1IntlPhone" type="string" default="" />
        <cfargument name="Variable1Country" type="string" default="" />
        <cfargument name="Variable1Email" type="string" default="" />
        <cfargument name="Variable2Name" type="string" default="" />
        <cfargument name="Variable2Institution" type="string" default="" />
        <cfargument name="Variable2Address1" type="string" default="" />
        <cfargument name="Variable2City" type="string" default="" />
        <cfargument name="Variable2State" type="string" default="" />
        <cfargument name="Variable2Province" type="string" default="" />
        <cfargument name="Variable2Zipcode" type="string" default="" />
        <cfargument name="Variable2PostalCode" type="string" default="" />
        <cfargument name="Variable2Phone" type="string" default="" />
        <cfargument name="Variable2IntlPhone" type="string" default="" />
        <cfargument name="Variable2Country" type="string" default="" />
        <cfargument name="Variable2Email" type="string" default="" />
    From Firebug
    argumentCollection{
    "CurrentApplicationStep":"Lyric-Opera",
    "ScreenSelection":"Submit",
    "Role1":"Abigail",
    "Opera1":"The Crucible",
    "Company1":"Kingwood Summer Opera",
    "Year1":"2010",
    "Role2":"Title role",
    "Opera2":"Suor Angelica",
    "Company2":"Kingwood Summer Opera",
    "Year2":"2008",
    "Role3":"Lauretta",
    "Opera3":"Gianni Schicchi",
    "Company3":"Sam Houston State University",
    "Year3":"2007",
    "Aria1":"Tacea la notte placida",
    "Aria1Opera":"Il Trovatore",
    "Aria1Language":"Italian",
    "Aria2":"Song to the Moon",
    "Aria2Opera":"Rusalka",
    "Aria2Language":"Czech",
    "Aria3":"Embroidery Aria",
    "Aria3Opera":"Peter Grimes",
    "Aria3Language":"English",
    "Variable1Name":"Todd R Miller",
    "Variable1Institution":"Lonestar College Kingwood",
    "Variable1Address1":"20000 Kingwood Dr",
    "Variable1City":"Kingwood",
    "Variable1State":"TX",
    "Variable1Province":"",
    "Variable1Zipcode":"77339",
    "Variable1Phone":"281-312-1485",
    "Variable1IntlPhone":"",
    "Variable1Country":"USA",
    "Variable1Email":"[email protected]",
    "Variable2Name":"Anne Heath-Welch",
    "Variable2Institution":"Todd Miller",
    "Variable2Address1":"309 East 13th Street",
    "Variable2City":"Houston",
    "Variable2State":"TX",
    "Variable2Province":"",
    "Variable2Zipcode":"77008",
    "Variable2Phone":"832-335-9108",
    "Variable2IntlPhone":"",
    "Variable2Country":"USA",
    "Variable2Email":"[email protected]",
    "Variable1Postalcode":"",
    "Variable2Postalcode":"",
    "Submit":"Continue"}
    methodLyricOpera
    returnFormat
    json

    The fix is to set "setHTTPMethod("POST");" for the AJAX proxy.  By default, the proxy function "setHTTPMethod("method");"  is set to "GET" and 47 input fields with corresponding data is over the limit.  The proxy function, "setHTTPMethod("method");", must be set to "POST" to avoid this error.

  • Is it possible to use AJAX for onblur method -- ADF

    Is it possible to execute a javascript action method for (onblur,onclick etc.,) using AJAX?
    For example according to the selection made in a list box, some fields are hidden or rendered. This is done with out any javascript code written in ADF using AJAX.
    Like wise for onblur etc., can we use AJAX?
    I want to save the record when I tab out from the last field of the record.
    Please let me know how I can do this.
    Thanks,
    venki

    Hi,
    I think the easiest way out of this is to use a commit button on the page, give it an ID and then look it up using document.getElementById("form:Id");. submit this handle (note that buttons are rendered as links). This doesn't require an Ajax call
    Frank

Maybe you are looking for

  • Boot Camp Won't Load after adding Mavericks

    How things started 13" MacBook Air mid-2011 Mac OS X Lion 10.7.5 (11G63b) with 256gb SSD HDD partition between OS/X and a BOOTCAMP partition running Windows 7 SP1 x64 Ultimate I updated both OSes with the latest drivers. In Lion, I did (disabled now)

  • Multiple Movie symbols into one sprite sheet

    I have my character split into different symbols. Arms, Head, Body and so on. Each symbol (movie clip) has its own timeline of animation. How do I get all of my symbols into one clip without losing animation? I've tried selecting all of the symbols a

  • Item 1000 should be created; a maximum of 999 item

    Hi Experts, while creating the idoc in ECC we are getting error message Item 1000 should be created; a maximum of 999 item. this is problem is occuring when we process the large file from SAP PI. the condition is large file should not be split. to re

  • Log file parallel write

    Hi, on 11g R2. I have the following : SQL> select  total_waits, time_waited from v$system_event where event='log file parallel write'; TOTAL_WAITS TIME_WAITED       74144       28100Is it too much or not ? These valuses , to what should be compared ?

  • Change file in Zip archive without repacking

    Hi All, I have Zip archive. It contains ~100000 files. I needed to change only one file, without repacking all Zip archive. How can I do this? Do smb have such situations?