0

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>
3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by varun allahabad
0

hello friend....
your problem can be easily solved.....
here is code to solve ur problem
if(Textbox1.text="") then
' do what u like
end if

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.