I am using the jQuery Address plug-in (http://www.asual.com/jquery/
address/) to enable bookmarking and back and forward buttons in a
document search portlet. I have things working well when there is only
one search portlet on the page. However, when I put two search
portlets on the page, events are being fired twice for some reason.
The portlets and JS code are all namespaced properly, so I am not sure
why this is happening.

Below is some of the relevant code. Any ideas? I am close to tearing
my hair out of this one!

<div id="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_container">
        <div id="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_msg"
class="alert" style="display: none;"></div>
        <form action="/ice/site/nshaw/template.RAW/cml_home/?
javax.portlet.tpst=2e0bae46a2d47944ddcac6101ad46f14_ws_RW&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken"
name="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_form"
id="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_form" method="post">
        <input type="hidden" name="searchType" value="simplesearch">
        <div
id="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_simple">Keyword:
<input type="text" name="keyword" />&nbsp; <input
id="V_2e0bae46a2d47944ddcac6101ad46f14_cmlSearch_submitBtnTop"
type="submit" value="Search"/></div>
        </form>
</div>

jQuery(document).ready(function() {
        bindSearchForm('V_2e0bae46a2d47944ddcac6101ad46f14');
});

function bindSearchForm(ns) {
        var nsPrefix = "#"+ns+"_";
        jQuery(nsPrefix+"cmlSearch_form").bind("submit", function() {
                jQuery.address.value("searchresults/"+ns+"/"+getUniqueId());
                return false;
        });
}

Reply via email to