This is my first post, I'm new to programming.
I'm trying to update an existing site.
Here is my problem, I'm looking to have my textbox submit only when input has been entered. If the box is empty, null or simply has nothing entered I want an astirisk to appear next to the input box to show that text must be entered.
Here is the code I'm using, I know it is something simple that I'm screwing up.
<script language="javascript">
function onlyInts(objEvent) {
ikeyCode = objEvent.keyCode;
if (ikeyCode >= 48 && ikeyCode <= 57) { return true; }
return false;
}
function onlyAlphaNumeric(objEvent) {
ikeyCode = objEvent.keyCode;
if (ikeyCode >= 48 && ikeyCode <= 57 || ikeyCode >= 65 && ikeyCode <= 90 || ikeyCode >= 97 && ikeyCode <= 122) { return true; }
return false;
}
</script>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>Product number</td>
<td>
this.controlname.attributes.add("onkeypress","return onlyAlphaNumeric(event)");
<asp:RequiredFieldValidator id="valcontrolname" ControltoValidate="controlname" errorMessage="* " forecolor="#FF0000" display="dynamic" runat="server" />
<asp:TextBox ID="TextBoxPartNumber" runat="server"></asp:TextBox></td>
<asp:TextBox runat="server" style="visibility:hidden;display:none;"/>
<td><asp:Button ID="ButtonSearch" runat="server" Text="Search" /></td>
</tr>