After typing in the Search box and hitting Enter, it stays on the
same page and won't go to Search page unless I hit the Search Button.
It gives this "Error on Page" error:
Webpage error details
Message: 'document.getElementById(...)' is null or not an object
Line: 125
Char: 85
Code: 0
URI: http://localhost/DCP3/Default.aspx
The same message for all other pages like Categories:
Message: 'document.getElementById(...)' is null or not an object
Line: 125
Char: 85
Code: 0
URI: http://localhost/DCP3/ADVENT-ITEMS-C371.aspx
Anyone know how this can be fixed? Thanks
Enter Key not working for Search
Re: Enter Key not working for Search
It works in FireFox but not in IE 8, which unfortunately 70% of the
customers are using.
customers are using.
Re: Enter Key not working for Search
Try a quick fix I am not sure but it may work. Have a look at the source code of button. Is it a link button. If its a link button then simply change it to ASP Button and then again try it in IE.
Re: Enter Key not working for Search
The button in the code is "<asp:Button ID="SearchButton" runat="server" Text="GO!" ....
Should I change it to a ASP Link Button instead?
Here is the Source code from Default.aspx :
<input type="submit" name="ctl00$wpm$HomePage$ctl00$SearchButton" value="GO!"
onclick=
"if(Page_ClientValidate('Search')){window.location='/DCP3/Search.aspx?k='+encodeURIComponent(ctl00_wpm_HomePage_ctl00_SearchPhrase.value);}return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$wpm$HomePage$ctl00$SearchButton", "", true, "Search", "", false, false))"
id="ctl00_wpm_HomePage_ctl00_SearchButton" />
Should I change it to a ASP Link Button instead?
Here is the Source code from Default.aspx :
<input type="submit" name="ctl00$wpm$HomePage$ctl00$SearchButton" value="GO!"
onclick=
"if(Page_ClientValidate('Search')){window.location='/DCP3/Search.aspx?k='+encodeURIComponent(ctl00_wpm_HomePage_ctl00_SearchPhrase.value);}return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$wpm$HomePage$ctl00$SearchButton", "", true, "Search", "", false, false))"
id="ctl00_wpm_HomePage_ctl00_SearchButton" />
Code: Select all
I'm guessing the line below in ConLib\Custom\SimpleSearch.ascx.cs is causing the problem :
string handleEnterScript = "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"
+ SearchButton.UniqueID + "').click();return false;}} else {return true}; ";
If I put a break point in and step into the line, the line above gives this:
"if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {
document.getElementById('ctl00$wpm$HomePage$ctl00$SearchButton').click();return false;}} else {return true}; "
Re: Enter Key not working for Search
The ID in the Source is: id="ctl00_wpm_HomePage_ctl00_SearchButton"
But a break point in the code is showing:
document.getElementById('ctl00$wpm$HomePage$ctl00$SearchButton')
are the Question marks the problem and should be replaced by underscores?
But a break point in the code is showing:
document.getElementById('ctl00$wpm$HomePage$ctl00$SearchButton')
are the Question marks the problem and should be replaced by underscores?
Re: Enter Key not working for Search
Anyboby know anything about JavaScript?
That seems to be the problem but I'm not javascript master.
That seems to be the problem but I'm not javascript master.
Re: Enter Key not working for Search
The Search works on FireFox. I found one difference:
FireFox view source:
onclick="if(Page_ClientValidate('Search')){window.location='/Search.aspx?
IE8:
onclick="if(Page_ClientValidate('Search')){window.location='/DCP3/Search.aspx?
The Search page is in the root folder and this seems to be the problem.
Is anyone else experiencing this problem?
FireFox view source:
onclick="if(Page_ClientValidate('Search')){window.location='/Search.aspx?
IE8:
onclick="if(Page_ClientValidate('Search')){window.location='/DCP3/Search.aspx?
The Search page is in the root folder and this seems to be the problem.
Is anyone else experiencing this problem?