replace protocol in geoext.form.formpanel‏‏

Hi all,

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:

If everything is being set as expected, but the formPanel.search() function is still failing, then double check that this is successful if hardcoded into the protocol to begin with.

The only other option I would investigate before searching for someone with specific GeoExt assistance, would be to see if destroying and re-instantiating the form (with the correct protocol assigned) would be a possibility.

this is formPanel: [object Object]
this is 1st formPanel.protocol: null
this is 2nd formPanel: [object Object]
TypeError: o.protocol is null

so I think it's clear that the formPanel.protocol = proto; is sending nothing to the formPanel because the proto there is still null (as it was set at the beginnig).

Your second option sounds interesting, the thing is if I destroy the form it dissapears after pressing the search button and don't know well how to re-instantiating it . This form is inside an Ext.Window btw. Let me post my code and see how can I do that please:

sorry for my late answer to your last message. After checking with illuminations (because firebug is already installed), I noticed that the new searchformPanel.protocol (3rd console.log you refered) works well as you pointed out, but it's not being sent back to the searchformPanel, or at least is not read by it. With illuminations I went to the SearchAction.js (line 122) (the error in firebug) and pointing with the cursor to that line I saw that protocol is still null (o.protocol.read), here I show you the part of the SearchForm.js: