Hi I have two text boxes where user can enter search text. When the user clicks on the search button both the text boxes should not be empty. If the user enters some value in one text box they should be able to search.
I am trying to use java script for this.
Here is the code I have written. But nothing happens when both text boxes are empty and user clicks on the Search button. Please help.
function ValidateDevice()
{
var a= document.getElementById("txt1")
var b= document.getElementById("txt2")
if (a.Value) = ""
{
if (a.Value) = "" Then
{
document.write = "Please enter value in one of the text boxes"
return false
}
else
return true
}
<asp:TextBox ID="txt1" runat="server" </asp:TextBox>
<asp:TextBox ID="txt2" runat="server" </asp:TextBox>
<asp:Button ID="btn_search" runat="server" OnClientClick = "ValidateDevice"/>