I could never get the clear cookies to happen on a No Result page or to happen on any
event other than onclick. What I did to solve this was add text to the .js when
nothing was found. It looks good and coincides with the GSA returning suggestions on
how to return results. I put the following code at end of the function
mTOutputParametric(idName) just before document.getElementById(idName).innerHTML =
mTResult;.
else
{
mTResult = "<h3>" + mTHeader + "</h3> <div style=\"text-align: center;\"><br /><a
href=\"" + clearURL + "\" onClick=\"clearAllCookies();\"><font color=\"red\"
size=\"3\">Reset All Filters</font></a></div>";
mTResult += "<div><br />Suggestions:<ul><li>Try resetting all
filters.</li></ul></div>";
}
http://gsa.boats.net/search?q=123456789&site=default_collection&filter=0&btnG=Search&entqr=3&getfields=*&entsp=0&output=xml_no_dtd&sort=date%3AD%3AL%3Ad1&client=boats_frontend&ud=1&spell=1&oe=UTF-8&ie=UTF-8&proxystylesheet=boats_frontend
Jul 24, 2008
issue 3
(Need a clearAllCookies() when no results) commented on by price.jp
- That still didn't seem to fix the problem. It clears the cookies but leaves
partialfields in the URL.
What I ended up doing is adding this function and calling it from the search text
box onsubmit="clearAllCookiesAndPartialFields()"
// Clear all the appropriate cookies and PartialFields from URL
function clearAllCookiesAndPartialFields()
{
var x=document.getElementsByName("partialfields");
if ( x.length > 0)
{
document.getElementsByName("partialfields")[0].value="";
document.getElementsByName("partialfields")[1].value="";
}
clearAllCookies();
}
Not sure if this is the best way to do this but it seems to work.
That still didn't seem to fix the problem. It clears the cookies but leaves
partialfields in the URL.
What I ended up doing is adding this function and calling it from the search text
box onsubmit="clearAllCookiesAndPartialFields()"
// Clear all the appropriate cookies and PartialFields from URL
function clearAllCookiesAndPartialFields()
{
var x=document.getElementsByName("partialfields");
if ( x.length > 0)
{
document.getElementsByName("partialfields")[0].value="";
document.getElementsByName("partialfields")[1].value="";
}
clearAllCookies();
}
Not sure if this is the best way to do this but it seems to work.