<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Dear users,<br><br>Since extjs, geoext, openlayers are javascript libraries, I've tried things such as "eval" to make variables accessible in the code below but
no luck so far. I want to update or replace a variable (ie. in the protocol) that is at first
null (so null in protocol and also outside formPanel), then defined with something (ie. inside the handler function, is it right to define it there?) and then
use it inside a variable (as proto in "protocol: proto", so replace the one is already null), here is an example:<br><br><pre style="" class="default prettyprint prettyprinted"><code><span class="kwd">var</span><span class="pln"> proto </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"> </span><span class="com"># <--- replace here (old "proto")</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> formPanel </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">GeoExt</span><span class="pun">.</span><span class="pln">form</span><span class="pun">.</span><span class="typ">FormPanel</span><span class="pun">({</span><span class="pln">
protocol</span><span class="pun">:</span><span class="pln"> proto</span><span class="pun">,</span><span class="pln"> </span><span class="com"> # <--- or replace here (old "proto")</span><span class="pln">
items</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[{</span><span class="pln">
xtype</span><span class="pun">:</span><span class="pln"> </span><span class="str">"combo"</span><span class="pun">,</span><span class="pln">
id</span><span class="pun">:</span><span class="pln"> </span><span class="str">"idcombo"</span><span class="pun">,</span><span class="pln">
etc</span><span class="pun">...</span><span class="pln">
</span><span class="pun">},</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
xtype</span><span class="pun">:</span><span class="pln"> </span><span class="str">"textfield"</span><span class="pun">,</span><span class="pln">
id</span><span class="pun">:</span><span class="pln"> </span><span class="str">"idtext"</span><span class="pun">,</span><span class="pln">
etc</span><span class="pun">...</span><span class="pln">
</span><span class="pun">}],</span><span class="pln">
button</span><span class="pun">:[{</span><span class="pln">
text</span><span class="pun">:</span><span class="pln"> </span><span class="str">"search"</span><span class="pun">,</span><span class="pln">
handler</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
formPanel</span><span class="pun">.</span><span class="pln">search</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> combo </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Ext</span><span class="pun">.</span><span class="pln">getCmp</span><span class="pun">(</span><span class="str">'idcombo'</span><span class="pun">).</span><span class="pln">getValue</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> text </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Ext</span><span class="pun">.</span><span class="pln">getCmp</span><span class="pun">(</span><span class="str">'idtext'</span><span class="pun">).</span><span class="pln">getRawValue</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> proto</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Protocol</span><span class="pun">.</span><span class="pln">HTTP</span><span class="pun">({</span><span class="pln"> </span><span class="com"># <------- new "proto" to replace above</span><span class="pln">
url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"http://www.pub.pub/"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> combo </span><span class="pun">+</span><span class="pln"> </span><span class="str">"/rhen/"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> text
</span><span class="pun">}),</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="pun">}]</span><span class="pln">
</span><span class="pun">});</span></code></pre>is is possible to use this new "proto" to replace the old "proto"? if so, how can I do it?, not sure if new "proto" has to go in
the handler: function. I defined "var proto = null" at first because <span class="comment-copy">without it the formPanel doesn't render due to "<code>proto is not defined</code></span>". I'll appreciate your support, thanks in advance.<br><br>Best regards,<br><br>Gery<br><br>                                            </div></body>
</html>