topcoder1
19 Jul 2007, 2:59 PM
I can't get the InfoPanel.GoogleSearch to work, I traced through the source and found that it can't find the imbedded search form using the "form" selector, see code and comments for detail:
any idea what's wrong? thanks
code for using Ext.ux.InfoPanel.GoogleSearch:
// add google search panel
var pnGoogle = new Ext.ux.InfoPanel.GoogleSearch('google-search', {
//icon: iconPath + 'magnifier.png'
//, searchBtnIcon: iconPath + 'magnifier.png'
searchTextSize: 25
, searchResultIframe: 'center-result'
});
pnGoogle.searchButton.on({
click: {
fn: function() {
layout.getRegion('center').getTabs().getTab('center-result').activate();
}}
});
layout.add('south',pnGoogle);
Ext.ux.InfoPanel.GoogleSearch source code:
Ext.ux.InfoPanel.GoogleSearch = function(el, config, content) {
if(Ext.isGecko) {
this.autoScroll = true;
}
// call parent constructor
Ext.ux.InfoPanel.GoogleSearch.superclass.constructor.call(this, el, config);
// create nicer Ext form
var gsForm = this.body.select('form').item(0);
// problem: this.body.select('form') returns a result with 0 children.
...
}
my html code:
<div id="google-search">
<form method="get" action="http://www.google.com/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></a>
<br/>
<input type="hidden" name="domains" value="extjs.com">
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="31" maxlength="255" value="" id="sbi">
</td></tr>
<tr>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0">
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="extjs.com" id="ss1">
<label for="ss1" title="Search extjs.com"><font size="-1" color="#000000">extjs.com</font></label></td>
</tr>
</table>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb">
<input type="hidden" name="client" value="pub-2768521146228687">
<input type="hidden" name="forid" value="1">
<input type="hidden" name="channel" value="5229340506">
<input type="hidden" name="ie" value="UTF-8">
<input type="hidden" name="oe" value="UTF-8">
<input type="hidden" name="safe" value="active">
<input type="hidden" name="flav" value="0000">
<input type="hidden" name="sig" value="Q5eZe3WjG3paVCPs">
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1">
<input type="hidden" name="hl" value="en">
</td></tr></table>
</form>
</div>
a slightly unrelated issue I have been having is that why don't the author of the user extension components published the original html instead of the final output html which is cluttered by the extra html ext adds on. The original html might have server side code, but at least it would give user better idea on integration. Unless there are concerns I have not thought of..
any idea what's wrong? thanks
code for using Ext.ux.InfoPanel.GoogleSearch:
// add google search panel
var pnGoogle = new Ext.ux.InfoPanel.GoogleSearch('google-search', {
//icon: iconPath + 'magnifier.png'
//, searchBtnIcon: iconPath + 'magnifier.png'
searchTextSize: 25
, searchResultIframe: 'center-result'
});
pnGoogle.searchButton.on({
click: {
fn: function() {
layout.getRegion('center').getTabs().getTab('center-result').activate();
}}
});
layout.add('south',pnGoogle);
Ext.ux.InfoPanel.GoogleSearch source code:
Ext.ux.InfoPanel.GoogleSearch = function(el, config, content) {
if(Ext.isGecko) {
this.autoScroll = true;
}
// call parent constructor
Ext.ux.InfoPanel.GoogleSearch.superclass.constructor.call(this, el, config);
// create nicer Ext form
var gsForm = this.body.select('form').item(0);
// problem: this.body.select('form') returns a result with 0 children.
...
}
my html code:
<div id="google-search">
<form method="get" action="http://www.google.com/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></a>
<br/>
<input type="hidden" name="domains" value="extjs.com">
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="31" maxlength="255" value="" id="sbi">
</td></tr>
<tr>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0">
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="extjs.com" id="ss1">
<label for="ss1" title="Search extjs.com"><font size="-1" color="#000000">extjs.com</font></label></td>
</tr>
</table>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb">
<input type="hidden" name="client" value="pub-2768521146228687">
<input type="hidden" name="forid" value="1">
<input type="hidden" name="channel" value="5229340506">
<input type="hidden" name="ie" value="UTF-8">
<input type="hidden" name="oe" value="UTF-8">
<input type="hidden" name="safe" value="active">
<input type="hidden" name="flav" value="0000">
<input type="hidden" name="sig" value="Q5eZe3WjG3paVCPs">
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1">
<input type="hidden" name="hl" value="en">
</td></tr></table>
</form>
</div>
a slightly unrelated issue I have been having is that why don't the author of the user extension components published the original html instead of the final output html which is cluttered by the extra html ext adds on. The original html might have server side code, but at least it would give user better idea on integration. Unless there are concerns I have not thought of..