hello, i need help in getting using one submit button to validate user's input afterr selecting between a textbox or combobox entry: here's my code:
<table border="1" bgcolor="#b4beda" style="MARGIN-LEFT: 0px; WIDTH: 645px">
<td><strong>Enter Security #</strong><input id="txtLpId" NAME="txtLpId" MAXLENGTH="5" TABINDEX ="1" style="WIDTH: 90px; HEIGHT: 20px; TEXT-ALIGN: left"></td>
<td align="middle"><input style="FONT-WEIGHT: bolder; WIDTH: 74px; COLOR: white; HEIGHT: 24px; BACKGROUND-COLOR: #7e7ec9" type="submit" value="Submit" name="btnSubmit" id ="btnSubmit" onmouseover ="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9'" onclick="return BtnSubmitValidation();" size=16></td>
<td><strong>or Owner</strong>
<td><SELECT id=cboGpOwner style="WIDTH: 96px" name=cboGpOwner">
<OPTION value=0 selected> </OPTION>
<OPTION value=1>AI</OPTION>
<OPTION value=2>PAL</OPTION>
<OPTION value=3>OTHER</OPTION>
<OPTION value=4>UNKNOWN</OPTION></SELECT></td>
<td align="middle"><input style="FONT-WEIGHT: bolder; WIDTH: 78px; COLOR: white; HEIGHT: 24px; BACKGROUND-COLOR: #7e7ec9" type="submit" value="Submit" name="btncboSubmit" id ="btncboSubmit" onmouseover ="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9' "onclick="return cboGpOwnerValidation();"></td>
<td align="middle"><input style="FONT-WEIGHT: bolder; WIDTH: 73px; COLOR: white; HEIGHT: 24px; BACKGROUND-COLOR: #7e7ec9" type="submit" value="Clear" name="btnClear" id ="btnClear" onmouseover="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9'" size=12></td>
<td align="middle width="0" height="0">
<input id="Text1" NAME="txtClicked" MAXLENGTH="6" style="WIDTH: 0px; COLOR: #000000; HEIGHT: 0px; BACKGROUND-COLOR: #c9c9c9; TEXT-ALIGN: left" readonly></td>
</tr></td>
Recommended Answers
Jump to Postnow is this going to be done on page or doing a post to the server? Doing it on page in classic ASP is called javascript. On the server just requires a post to the server and a return will post validation. Which one do you require?
Jump to PostWell do this:
<form id="frmacts2" name="frmacts2" action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">
Then have a hidden input field to let you know you're on your current page (not necessary as you can use request.form, but I would recommend it). If you use a hidden input, set the value to a …
Jump to PostThat is done through javascript. ASP is done clientside. ASP.NET has validation controls done client-side, but this is Classic ASP.
If you wish to do it clientside, you need javascript. A sample of this would be:
<script type="text/javascript" language="javascript> function btnSubmitValidation() { var secCode = document.getElementById("txtLpId"); …
Jump to PostI'm sorry, I really don't know what your problem is. Can you let me know of the error you're getting?
Jump to PostGot ya. Here:
Function BtnSubmitValidation Dim strL, strA, strS strL = Trim(document.acts2.txtLpId.value) strO = Trim(document.acts2.cboGpOwner.value) If Len(strL) > 0 And Len(strL) < 5 And strO = 0 Then Msgbox "Security Number must be five characters in length.", , "Input Validation" document.acts2.txtLpId.focus BtnSubmitValidation = False Elseif Len(strL) = …
All 19 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.