Coroico / AdvSearch

Dynamic content search add-on for MODx Revolution that supports results highlighting, faceted search and search in custom packages
21 stars 14 forks source link

Small part of JavaScript still rendered if addJs property is set to 0 #28

Closed gadgetto closed 12 years ago

gadgetto commented 12 years ago

The following part of JavaScript is still rendered at HTML footer if &addJs=0 - which causes a JScript error:

<!-- start AdvSearch header -->
<script type="text/javascript">
//<![CDATA[
advsea[advsea.length]='{"asid":"as0","cdt":""}';
//]]>
</script>
<!-- end AdvSearch header -->
gadgetto commented 12 years ago

I think the problem is in line 165, 166 of advsearform.class.php. The JS part is either renderend in HTML head or footer regardless of addJs=0

if ($this->config['addJs'] == 1) $this->modx->regClientStartupScript($jsHeader);
else $this->modx->regClientScript($jsHeader);
Coroico commented 12 years ago

This issue has been already fixed by the following piece of code:

    if ($this->config['addJs'] == 1)
        $this->modx->regClientStartupScript($this->config['jsSearchForm']);
    elseif ($this->config['addJs'] == 2)
        $this->modx->regClientScript($this->config['jsSearchForm']);
mdehaan commented 10 years ago

The docs say to set it to 0 to disable it. This is wrong. It has to be set to 2 to disable the Javascripts. http://rtfm.modx.com/extras/revo/advsearch/advsearch.advsearchform