Login Register

xhrPost -> Firefox fine, IE not so much

I'm having the following issue using xhrPost to submit form data in IE 6:

(When I submit in Firefox, everything works out great: the form is submitted when a user clicks the submit button, and the callback updates the proper div w/ the returned data.)

In IE, I get an "object Error" message from my XHRError function. This is unfortunate, because the entire user base for this application uses IE.

Reference code:

function testPost() {
            dojo.xhrPost( {
             url: ''dr_tm_w_0120.test_post'',
             form: ''orgForm'',
             load: testPostXHRCallback,
             error: testPostXHRError
            });
      }

The dr_tm_w_0120.test_post is a PL/SQL procedure that receives all of the form elements as arguments and outputs an htp.p response using Mod PL/SQL. This response is used in XHRCallback to update a div.

Besides digging around the Dojo Book and API, I've followed the example here:
xhrPost: http://www.dojoforum.com/2007/10/11/dojo-example-xhrget-and-xhrpost

Is there some kind of special setting Dojo needs for IE 6 to submit form content using IE 6? I don't understand why this would work in Firefox and not in IE, so if anyone has any tips, please advise.

Is that really the code

Is that really the code you're using? Because if it is, you have syntax errors. The values you're passing for url and form are each an undefined surrounded by empty strings. (Two single-quotes in a row make an empty string, not a double-quote character.)

A direct copy-and-paste of your code into FF 3 produces a SyntaxError.

RE: Is that really the code

Yes, that is the code.

The page is built using Mod PL/SQL, which the application's environment/architecture restricts us to. In Mod PL/SQL, the single quote is a special character. So the outer single-quotes get parsed out, and there is no syntax error.

Example of how to spit out web stuff in Mod PL/SQL:
--------------------------------------------------------------------------------
htp.p('
function testPost() {
dojo.xhrPost( {
url: ''dr_tm_w_0120.test_post'',
form: ''orgForm'',
load: testPostXHRCallback,
error: testPostXHRError
});
}

');
--------------------------------------------------------------------------------

Can you post your

Can you post your testPostXHRCallback function? I'm not entirely sure, but I believe that the error function is also called when errors within the load function occur.

Have you checked if testPostXHRCallback is called before testPostXHRError (using a debugger, adding an alert at its top, etc.)?

RE: Can you post your

I've included the functions below. When I test the screen in IE, the testPostXHRCallback is not entered (the alert does NOT execute). My understanding of this is that the error occurs when the form data is sent to the target procedure. However, this behavior does not happen in Firefox. In Firefox, everything works as expected. The target PL/SQL procedure simply accepts the form elements as passed variables, and then outputs data that the Callback should handle.

Side note 1: I also put exception handling in the target procedure to double check if the procedure is being entered and erroring out inside. I found that is not the case.

Side note 2: xhrGet works fine in the same application...so....unfortunately, that might end up being a fallback plan if I can't figure out how to get xhrPost working properly.

XHRCallback and XHRError functions...
---------------------------------------------------------------------------------------

function testPostXHRCallback(data,ioArgs) {
          alert(''post callback'');
          try{
          dojo.byId("messageDiv").innerHTML = data;
          }
          catch(ex){
                if(ex.name == "TypeError")
                {
                  alert("A type error occurred.");
                }
          }
          return data;
       }       
       function testPostXHRError(data, ioArgs) {
          alert(data);
          alert(''Error when retrieving data from the server!'');
          return data;
       }

---------------------------------------------------------------------------------------