passing string in "textfield" to another part in code

Hello,

I have one question about passing strings from one Ext.formPanel textfield to another part of the code. The thing is that I have two "textfield" in the formPanel and I want the words I enter there as part of the "url" I have in the code. Probably you may ask, why does this guy want that?? this is because the "url" I'm using has a PHP script that generates features stored in a postgis db table as GeoJSON.

1. url: "http://localhost/postgis_geojson.php?geotable=boreholes_point_wgs84&geomfield=geom": this generates the whole table "boreholes_point_wgs84" as GeoJSON.
2. url: "http://localhost/postgis_geojson.php?geotable=boreholes_point_wgs84&geomfield=geom&parameters=station ilike '%llena%'": this generates only one feature, the feature that has "llena" in the "station" column. So, in this way I can find the feature through the search form.

What I was thinking is if I can pass these two strings I enter in "textfield" and modify the "url" in the way that it can catch these two words and form, for example, the second case I put above. I was playing with this:

You will need to populate the col and str variables at the point where you're building the URL string - not just on page load. You can't use variables in the URL when they haven't been set yet!

I assume this will be during the click event of a button, or the submit of a form (i.e. once the textfield values have been populated)? You will probably need to overwrite the protocol url value upon this event firing, or alternatively use the provided Ext form submit or Ajax request functions to achieve the same goal (I'm not sure what benefit the OpenLayers.Protocol.HTTP section of your code provides).

so I need to set the "col" and "str" variables in the same place the url is located?? how could I do that? I though every variable has to be set outside another variable. In the code, the url is inside the "protocol" variable. Sorry but what does populate mean? I'm not very good at names like that. I think overwriting the default url (ie. deleting the queryable, etc) could work, but passing just the "col" and "str" variables to the url may be easier?? this is the whole code:

in this case the OpenLayers.Protocol.HTTP allows talking to the php script that generates the features stored in postgis table in geojson format, and these features are then plotted in the map as vectors and their properties displayed in a ext grid. The problem, as you understood correctly the first time, is that the url is not getting what I enter in the "textfield" and then the url is not contructed in the way it can output only the features are searched. I've read some examples using ajax but seems that is more complex that I'm trying to get here.

The only problem is how to overwrite the URL. Using Ext3.x you would do something like this:

Code:

store.proxy.setUrl('new url goes here');

However, I don't expect that will work with the geoExt store you are using, therefore this will require some investigation on your part. I would try something like the following, and see if this updates the URL value:

If this doesn't work, this will simply require some debugging on your part from inside the updateUrl() function. Start by console.logging the store and protocol objects, and see if you can successfully get the url value to update. There also must be some geoExt API documentation available somewhere which might be able to point you in the correct direction?

If none of these work, then possibly consider investigating whether you could achieve the same result with normal ExtJS data stores?