How can you report or display an error message when calling XSP.partialRefreshPost

I use custom event handlers for many parts of our application. Tim Tripcony describes this on his blog ... He will most likely (hopefully) answer that ...

Event handlers in my code are as follows:

    <xp:eventHandler
        id="newbsDoSomething"
        submit="true"
        event="calledbyid"
        refreshMode="complete">
        <xp:this.action>
            <![CDATA[#{javascript:doSomethingFromSomewhere();}]]>
        </xp:this.action>
    </xp:eventHandler>

Buttons or other controls execute these events with code that looks like this:

XSP.partialRefreshPost(("#{id:newbsDoSomething}", {
    params : {
        '$$xspsubmitvalue' : 'something that tells it what to do.'
    },
    onError : function(err) {
            alert('Whatever this method is doing got an error...');
            //I want to report the error here
    },
    onComplete : function() {
        // maybe do something else
    })
});

When I make a mistake (once in the blue moon) and the response to the AJAX request contains a stack trace. I want to put a button that does not necessarily display the stack trace on another page.

onError err undefined, . XSP, . Firebug, ?

/Newbs

0
1

, CSJS XSP._partialRefresh , onError . , w/o .

, eval, - :

function myErrHandler(){
    // just do some debugging
    // of ioArgs object 
    var arg = arguments[1];
    var txt = "";
    for( p in arg ){
        txt += p + " -> " + arg[p] + " [" + typeof( arg[p] ) + "]\n";
    }
    alert( txt );
}

XSP.partialRefreshPost("#{id:newbsDoSomething}", {
    onError : 'myErrHandler( arguments[0], arguments[1] )'
});

,

+2

All Articles