Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been scratching my head over this and I'm wondering if this is possible. I want to replace the protocol of the GeoExt.form.FormPanel in the following way:

  1. to render the formpanel, I defined a variable "proto" as null outside the formpanel (var proto = null).
  2. then "proto" goes inside the formpanel (protocol: proto).
  3. in the handler function of the button a new variable "proto" is defined. I want to replace this new variable inside the formpanel.

Since extjs, geoext, openlayers are javascript libraries, I've tried things such as "eval" to make the variable "proto" inside the handler accessible in the formpanel but no luck so far. Here it is a simplified example to show this:

var proto = null;

var formPanel = new GeoExt.form.FormPanel({
    protocol: proto,                # <--- replace with [1]
    items: [{
        xtype: "combo",
        id: "idcombo",
    }, {
        xtype: "textfield",
        id: "idtext",
        text: "search",
        handler: function() {
            var combo = Ext.getCmp('idcombo').getValue();      # <--- this works and gets the value chosen in "xtype: combo"
            var proto: new OpenLayers.Protocol.HTTP({          # <--- [1] (ie. new variable "proto")
                url: "" + combo + "/somestuff/",    # <--- this works
                format: etc...

how could I do this? I'll appreciate your support, thanks in advance.

Best regards,


share|improve this question
up vote 1 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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