[fpc-devel] fcl-web webdata example(s) on Windows has some problems

ABorka fpc-devel at aborka.com
Thu Aug 19 00:42:57 CEST 2010

> We can add the "rows" for convenience, but nevertheless the error handler
> must also handle the 'response' case.
> Michael.

Hi Michael,

I've created an updated ExtJS error handler for the demo programs that 
handle all these response messages from FCL-web without the need to 
change the internals and play with the "rows". We just need to update 
the *.js files for the demos.

=================================CODE START
   // Listen to errors.
   data.addListener('exception', function(proxy, type, action, options, 
res) {
     if (type === 'remote') {
             title: 'REMOTE EXCEPTION',
             msg: res.message,
             icon: Ext.MessageBox.ERROR,
             buttons: Ext.Msg.OK
     }else{//type === 'response'
       if (res.responseText !== undefined){//there is a responseText so 
we can process
         var succ = undefined;
         var mess = "";
         try {
//////mark start
           var response = Ext.util.JSON.decode(res.responseText);
           succ = response.success;
           mess = response.message;
//////mark end
           if ((succ !== undefined)&&(!succ)){//success == false
                 title: 'REMOTE EXCEPTION/ERROR',
                 msg: mess,
                 icon: Ext.MessageBox.ERROR,
                 buttons: Ext.Msg.OK
         catch (err) {
         	Ext.MessageBox.alert('ERROR', 'Could not decode server 
response: ' + res.responseText);
==================================CODE END
For XML communication we need to change between the "mark start / mark 
end" to
//////mark start
           var response = document.createElement('div');
           response.innerHTML = res.responseText;
           s = Ext.DomQuery.selectValue('success', response);
           switch (s.toLowerCase()) {
             case "true" : succ = true;
             case "false": succ = false;
           mess = Ext.DomQuery.selectValue('message', response);
//////mark end


More information about the fpc-devel mailing list