i have text box for search operation on user control.i have created java script for alert message if text box is empty. problem is that when any text box is empty alert message get called .......
need help plzzzzzzzz..................
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anupama SinghPosted May 8, 2009, 3:09 AM
val = event.keyCode;
textboxSearchValue=document.getElementById('<%=textBoxSearchWord.ClientID%>');
// if(!e) var e = window.event;
// if (e.keyCode) code = e.keyCode;
// else if (e.which) code = e.which;
//code contains the pressed key in all browsers
//alert("A) code is: " + code)
//if(document.getElementById('ctl00_horMenu_textBoxSearchWord.ClientID')){
if(textboxSearchValue.value=="" && val==13)
{
alert("Please Enter Text for search");
return false;
}
else
return true;
}
I call this javaScript on key press of search textbox
Niradhip ChakrabortyPosted May 8, 2009, 2:38 AM
Anupama SinghPosted May 7, 2009, 8:58 AM
thanks for repply......
But you are not getting my ques
vivek kulkarniPosted May 7, 2009, 7:59 AM
Hi,
I would suggest using the asp.net validation controls.
http://msdn.microsoft.com/en-us/library/aa479013.aspx
http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=46
However if you want you can validate using javascript.