Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter key not working for Search Button

Status
Not open for further replies.

MaryNET

Programmer
Jan 6, 2007
33
US
I'm getting this J.S. error when Enter is pressed for a Search.The page stays on the page it is on and doesn't perform a Search:

'document.getElementById(...)' is null or not an object

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. Can this be fixed?

Source code from Default.aspx(IE8) :

<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" />
 
Thanks. Good idea, .. it's inside the button code:

<asp:Button ID="SearchButton"
OnClick="SearchButton_Click" CausesValidation="true" ValidationGroup="Search"
OnClientClick="
if(Page_ClientValidate('Search')){{window.location='{0}?k='+encodeURIComponent({1}.value);}}return false;" />

Is that a J.S. function or one that is included in the app?
 
I took Page_ClientValidate('. . . out and
it didn't do anything.
 
MaryNET said:
'document.getElementById(...)' is null or not an object

My guess is that the actual error (I'm guessing that "..." wasn't really the invalid ID) would point to an ID that doesn't exist. getElementById doesn't usually lie about such things, so perhaps you should check this.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top