Although my question may be somewhat outdated, after exhausting all possible solutions, I am still unable to find a resolution. I am trying to create a function for verifying input fields: This particular function is functioning correctly:
function myFunction()
{
var x;
x = document.getElementById('<%=textBoxCustomerCode.ClientID%>').value;
if(isNaN(x) || x == "")
{
alert('Input Error');
return false;
}
else
{
return true;
}
}
and here is the code snippet:
<asp:ImageButton ID="imageButtonView" runat="server" Height="60px" ToolTip="Search" Width="60px" BorderStyle="Solid" ImageUrl="~/Images/searchButton.jpg" OnClick="imageButtonView_Click" OnClientClick="return myFunction();"/>
This function works effectively; however, I am now in need of a way to generalize the function so it can work with any input field. Is there any suggestion on how I can achieve this?