Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This question already has an answer here:

I'm using OL 2.11 with GeoExt 1.1. After testing and modifying this GeoExt example: http://geoext.org/lib/GeoExt/widgets/form/FormPanel.html, I had problems with destroying and reading the new protocol, I'm getting "TypeError: this.options is null HTTP.js (line 180)" in firebug. What I understand from this line 180 is that the new options (in the new protocol) are not there, not sure if this is the problem and how to solve it. This is the original protocol (created outside the FormPanel):

protocol = new OpenLayers.Protocol.HTTP({
    url: '/fs/',
    format: new OpenLayers.Format.GeoJSON({
        ignoreExtraDims: true,
        'internalProjection': new OpenLayers.Projection('EPSG:900913'),
        'externalProjection': new OpenLayers.Projection('EPSG:4326')
    })
});

This is the code at the end of the FormPanel where the new protocol is created:

    buttons: [{
        text: 'Search',
        handler: function() {

            comboLayer = Ext.getCmp('idcombo').getValue();
            keyword = Ext.getCmp('idtextfield').getRawValue();

            protocol.destroy();

            protocol = new OpenLayers.Protocol.HTTP({
                url: '/fs/' + comboLayer + '?format=GeoJSON&comments__ilike=' + keyword + '&queryable=comments',
                format: new OpenLayers.Format.GeoJSON({
                    ignoreExtraDims: true,
                    'internalProjection': new OpenLayers.Projection('EPSG:900913'),
                    'externalProjection': new OpenLayers.Projection('EPSG:4326')
                })
            });

            protocol.read();

            formPanel.search();
        }
    }]

In the case I remove "protocol.destroy();", both the original and the new protocols are sent, but always the original is sent after the new one, this happens because the request is AJAX? is it possible to send the new after the original?

I'd appreciate some support on this, thanks in advance,

share|improve this question

marked as duplicate by whuber Feb 14 '13 at 16:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 0 down vote accepted

The solution was to use only "protocol.options.url = newUrl;" instead of protocol.destroy(); or protocol.read();, a complete explanation is here

share|improve this answer
    
Because you have posted identical answers to your two questions, Gery, I presume they are really the same question and so have closed one as a duplicate. –  whuber Feb 14 '13 at 16:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.