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>
now 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?
now 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?
It's going to post to server, this is written strictly for vbscript:
Here's my code:
<form id="frmacts2" name="frmacts2" action="acts2.asp?L1=home&L2=limpart&L3=" method="post">
Well 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 unique value that you can reference. Then do something like:
<%
Dim strErrors, intErrCount
strErrors = "<font color=""red"">Please fill out the following fields:<br /><ul>"
intErrCount = 0
if (Trim(Request.Form("inputhidden"))) = "verifyfirst" then
if (Trim(Request.Form("cboGpOwner"))) = "0" and (Trim(Request.Form("txtLpId"))).length < 1 then
intErrCount = intErrCount + 1
strErrors = "<li>Please enter a security id or choose an owner from the list.</li>"
end if
if intErrCount < 1 then
response.redirect("acts2.asp?L1=home&L2=limpart&L3=" & (Trim(Request.Form("txtLpId"))) & (Trim(Request.Form("cboGpOwner"))))
else
strErrors = strErrors & "</ul></font>"
end if
end if
%>
Now where you want your error to display, put:
<%= strErrors %>
This code can be modified since you only really have one field to verify. You can eliminate the UL and LI terms for a bulleted list and just put the error code "Please fill out a security id or choose an owner from the list." But you should reference this code for validation that requires more than one field!
So, are saying that I shouldn't try to validate the fields upon entry - client-side?
That 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");
var ownerList = document.getElementById("cboGpOwner");
if (secCode.value.length < 1 && ownerList.value == 0) {
//Now you can set either a div to display the data
//Or you can use an alert to show a popup alert
alert('You must fill out a security id or choose an owner from the list before continuing!');
//Put a div on the page with the following ID: errDiv
//And uncomment next line to set a div's element/value
//document.getElementById("errDiv").innerHTML = '<div style="color:#FF0000;">Please fill in the security code or choose an owner.</div>'
return false;
}
return true;
}
</script>
That 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"); var ownerList = document.getElementById("cboGpOwner"); if (secCode.value.length < 1 && ownerList.value == 0) { //Now you can set either a div to display the data //Or you can use an alert to show a popup alert alert('You must fill out a security id or choose an owner from the list before continuing!'); //Put a div on the page with the following ID: errDiv //And uncomment next line to set a div's element/value //document.getElementById("errDiv").innerHTML = '<div style="color:#FF0000;">Please fill in the security code or choose an owner.</div>' return false; } return true; } </script>
Thanks for helping so far , I really didnt mean to say client-side, when i on-click btnsubmit();
the code is
Function BtnSubmitValidation
Dim strL
Dim strA
Dim strS
document.acts2.txtLpId.value = Trim(document.acts2.txtLpId.value)
strL = document.acts2.txtLpId.value
If Len(strL) > 0 _
And Len(strL) < 5 Then
Msgbox "Security Number must be five characters in length.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Exit Function
Elseif Len(strL) = 0 Then
Msgbox "Security Number cannot be blank.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Exit Function
End If
show_busy
BtnSubmitValidation = True
End Function
I'm sorry, I really don't know what your problem is. Can you let me know of the error you're getting?
I'm not getting an error I just wanted to have 1 submit button instead of 2 to validate a users chioce and then submit that value to the db for processing the report output.
I somewhat follow your original instructions for post = request.variable("SCRIPT-NAME")
but what goes in the inputhidden - I carried the txtinput value, but I hadn't determined the cboGpOwner value yet,,,that's were I had my problem
How to use 1 submit button to enter users choice after they've made their selection either
txtinput = checkbox or cboGpOwner = combobox drop select?
Got 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) = 0 And strO = 0 Then
Msgbox "Please type in a Security Number or choose from the Owner List.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Elseif Len(strL) > 0 And strO <> "0"
Msgbox "You cannot use both, Security Number and Owner List.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Else
show_busy
BtnSubmitValidation = True
End If
End Function
Now this will do both of them and give these results:
1. if Security ID text box has any value with characters less than 5 and no choice was chosen on the owner list, then "Security Number must be five characters in length."
2. if Security ID text box has no value and no owner was chosen from the list, "Please type in a Security Number or choose from the Owner List."
3. if both a Security ID and a owner was chosen, "You cannot use both, Security Number and Owner List."
I would remove number 3 and if both are chosen, take the security id over the owner list. However, if you do this, remove number 3 and remove the strO from the first part of the if statement (change the first part of the if statement to):
If Len(strL) > 0 And Len(strL) < 5 Then
My 1st line is OK .
Here's the input validation respone if txtinput is clicked:
<input id="txtClicked" NAME="txtClicked" MAXLENGTH="6" style="WIDTH: 0px; COLOR: #000000; HEIGHT: 0px; BACKGROUND-COLOR: #c9c9c9; TEXT-ALIGN: left" readonly></td>
Here's the onclick cbobtnValidation if combo.item selected :
<td align="middle"><input style="FONT-WEIGHT: bolder; WIDTH: 78px; COLOR: white; HEIGHT: 24px; BACKGROUND-COLOR: #7e7ec9" type="submit" value="Submit" name="btncboSubmit" id ="Submit1" onmouseover ="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9' "onclick="return cboGpOwnerValidation(); frmLpContacts3.submit(strglpid);"></td>
Is there a way to only have 1 submit?
yes, just remove the extra submit buttons and only keep one with an onclick of "return cboGpOwnerValidation()" or rename the function to whatever you wish. It is already set up, just make only one button and set the name to whatever you wish.
Sorry I put the wrong text in for btnSubmitValidation...so your saying get rid of it(btnSsubmitValidation) and do this next, If strL > 0 or <5 and strs > 0 do this , then post to server with the value based on hidden field = true.....
just post your entire code, in code blocks [ code ][/ code ] but without the spaces inside those tags. I will fix it and post it for you!
just post your entire code, in code blocks [ code ]
svrClicked = ""
clickedButton = ""
svrError = ""
svrStatus = ""
svrRetrieve = ""
If Len(Request.Form("btnSubmit")) Then
svrLpId = Request.Form("txtLpId")
clickedButton = "Submit"
call build_rsSecSummary()
svrRetrieve = "YES"
Else
If Len(Request.Form("btnClear")) Then
clickedButton = "Clear"
End If
End If
Sub PssDelObj(obj)
If isobject(obj) then
If typename(obj) = "Recordset" Then
If obj.state <> 0 Then
obj.close
End If
End If
set obj = nothing
End If
End subFunction build_rsSecSummary()
dim objSummary2
PssDelObj(objSummary2)
PssDelObj(rsSecSummary)
set objSummary2 = Server.CreateObject("PssPalInterface.PalCommonCls")
set rsSecSummary = objSummary2.get_GP_secinfo(svrLpId)
svrTotCols = rsSecSummary.Fields.Count
If svrTotCols = 2 Or rsSecSummary.RecordCount = 0 Then
svrError = "NotFound"
Exit Function
End If
End Function
Function ToNumString(number,size)
Dim leadingZeroes
Dim digitCount
number = Replace(number," ","")
digitCount = len(number)
If digitCount >= size Then
ToNumString = left(number, size)
Exit Function
End If
leadingZeroes = size - digitCount
ToNumString = String(leadingZeroes, "0") & number
End Function
Function ToStrWithTrailingSpaces(str, size)
Dim trailingSpaces
Dim byteCount
str = Trim(str)
byteCount = len(str)
If byteCount >= size Then
ToStrWithTrailingSpaces = left(str, size)
Exit Function
End If
trailingSpaces = size - byteCount
ToStrWithTrailingSpaces = str & Space(trailingSpaces)
End Function
%>
<html>
<head>
<link REL="stylesheet" TYPE="text/css" HREF="../css/art.css">
<META name=VI60_defaultClientScript content=VBScript>
<!--#include file= "t_head.asp"-->
<!--#include file="Utility.asp"-->
<!--#include file="Format.asp"-->
<!--#include file="standardLayout.asp"-->
<!--#include file="Customizerinc.asp"-->
<!--#include file="MenuUtility.asp"-->
<!--#include file="PssUtility.asp"-->
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Dim prevRowChosen
Dim prevRowChosenBgColor
Dim strArfSelected
Dim strPrevDetailsString
Sub window_onload
Dim li_index
Dim li_index2
prevRowChosen = ""
strArfSelected = ""
strPrevDetailsString = ""
If "<%=clickedButton%>" = "Submit" Then
'document.frmLpContacts2.cboGpOwner.value = "<%=strglpid%>" document.frmLpContacts2.txtLpId.value = "<%=svrLpId%>"
document.frmLpContacts2.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
If Len("<%=svrError%>") Then
If "<%=svrError%>" = "NotFound" Then
Msgbox "No matching data found for the specified search criteria.", ,"Search Error"
Exit Sub
Else
mainframeErrorBox("<%=svrError%>")
End If
Exit Sub
End If
setTabChosen(tabDetails)
setTabSunken(tabSummary)
wndSummary.style.visibility = "hidden"
wndDetails.style.visibility = "visible"
Else
setTabChosen(tabSummary)
setTabSunken(tabDetails)
document.frmLpContacts2.style.visibility = "visible"
document.frmLpContacts2.txtLpId.focus
wndSummary.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
End If
End Sub
Sub window_onunload
close_busy
End Sub
Sub tabDetails_onclick
strRetrieved = "<%=svrRetrieve%>"
If strRetrieved = "YES" Then
If BtnSubmitValidation() = True Then
setTabChosen(tabDetails)
setTabSunken(tabSummary)
wndSummary.style.visibility = "hidden"
wndDetails.style.visibility = "visible"
End If
End If
close_busy
End Sub
Sub tabSummary_onclick
setTabChosen(tabSummary)
setTabSunken(tabDetails)
wndSummary.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
End Sub
Sub txtLpId_onkeypress
window.event.keyCode = Asc(UCase(Chr(window.event.keyCode)))
End Sub
Function BtnSubmitValidationDim strL
Dim strA
Dim strS
document.frmacts2.txtLpId.value = Trim(document.frmacts2.txtLpId.value)
strLpId = document.frmacts2.txtLpId.value
If Len(strL) > 0 _
And Len(strL) < 5 Then
Msgbox "Security Number must be five characters in length.", , "Input Validation"
document.frmacts2.txtLpId.focus
BtnSubmitValidation = False
Exit Function
Elseif Len(strL) = 0 Then
Msgbox "Security Number cannot be blank.", , "Input Validation"
document.frmacts2.txtLpId.focus
BtnSubmitValidation = False
Exit Function
End If
show_busy
BtnSubmitValidation = True
End Function
Function cboOValidation
' Check to see if the user entered anything.
If document.frmacts2.cboGpOwner.value = 0 Then
MsgBox "You must enter an Owner before submitting."
Exit Function
End If
If document.frmacts2.cboGpOwner.value = 1 Then
strglpid = "AI"
End If
If document.frmacts2.cboGpOwner.value = 2 then
strgplpid = "PAL"
End If
If document.frmacts2.cboGpOwner.value = 3 then
strglpid = "OTHER"
End If
If document.frmacts2.cboGpOwner.value = 4 then
strglpid = "UNKNOWN"
End If
show_busy
cboGpOwnerValidation = True
'document.frmLpContacts2.submit
End Function
Function inputCommaNumberOnly
If (window.event.keyCode < 48 Or window.event.keyCode > 57) _
And (window.event.keyCode <> 44) Then
window.event.keyCode = 0
End If
End Function
Function inputNumberOnly
If (window.event.keyCode < 48 Or window.event.keyCode > 57) Then
window.event.keyCode = 0
End If
End Function
Function toUpperCase
window.event.keyCode = Asc(UCase(Chr(window.event.keyCode)))
End Function
-->
</SCRIPT>
</head>
<BODY marginwidth = "0" marginheight = "0" topmargin=0 leftmargin=0 bgColor=white text=blue background=../nav/backgrnd.gif >
<%NavbarEx%>
<% call InitMenu()
call InitMainMenu()
call drawmenu ("GP Contacts","PLP.asp","",false,false)
call drawmenu ("LP Contacts","acts2.asp","",true,false)
call endMainMenu()
call initSubMenu()
call drawmenu ("Print","","Print",false,false)
call drawmenu ("Contact Us","","ContactUs",false,false)
call endSubMenu()
call endMenu()
%>
<form id="frmacts2" name="frmacts2" action="tacts2.asp?L1=home&L2=limpart&L3=" method="post"><div id=divTab style="LEFT: 100px; WIDTH: 500px; POSITION: absolute; TOP: 98px; HEIGHT: 15px">
<table border=0 cellspacing=0 cellpadding=0 align="left">
<tr>
<td id="tabSummary" style="WIDTH: 175px; HEIGHT: 30px; BACKGROUND-COLOR: #b4beda" align="middle">Query</td>
<td id="tabDetails" style="WIDTH: 175px; HEIGHT: 30px; BACKGROUND-COLOR: #a9a9a9" align="middle">Contact</td>
</tr>
</table>
</div>
<div id="wndSummary" style="MARGIN-LEFT: 0px; POSITION: absolute; TOP: 53px">
<table bgcolor="#b4beda" width="655" height="100" border=0 cellspacing="0" cellpadding="0" align="left" class="main">
<tr align="middle" height=68>
<td colspan=3>
<table border="1" bgcolor="#b4beda" style="MARGIN-LEFT: 0px; WIDTH: 645px">
<TBODY>
<tr><td>
<table style="MARGIN-LEFT: 0px" border="0">
<TBODY>
<tr>
</tr>
<tr>
<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>
<input id="txtClicked" NAME="txtClicked" MAXLENGTH="6" style="WIDTH: 0px; COLOR: #000000; HEIGHT: 0px; BACKGROUND-COLOR: #c9c9c9; TEXT-ALIGN: left" readonly></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 ="Submit1" onmouseover ="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9' "onclick="return cboOValidation();"></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>
</table></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</div>
<div id="wndDetails" style="MARGIN-LEFT: 0px; POSITION: absolute; TOP: 53px">
<table border=0 cellspacing="0" cellpadding="0" style="MARGIN-LEFT: 0px; WIDTH: 645px; HEIGHT: 296px" bgcolor="#b4beda" align="left" class="main">
<tr align="middle" valign="top">
<td colspan=4>
<%
If svrError <> "NotFound" Then
If svrMsgEmpty = "Empty" Then
%>
<table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9"><tr align="middle"><td align=middle height=20 colspan=2 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">
NO CONTACT FOR THIS LP
</td>
</tr>
</table>
<%
Elseif svrRetrieve = "YES" Then
%>
<table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9"><table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9">
<tr align="middle">
<td align=middle height=20 colspan=6 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">
LP CONTACTS
</td>
</tr>
<tr align="left">
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Security No.</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">LP Name</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Description</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Contact Type</td><%
backColor = "#b4beda"
rsSecSummary.MoveFirst
li_index2 = 1Do While Not rsSecSummary.EOF
svrSecLpId = rsSecSummary.fields("lp_id")
svrSecCusip = rsSecSummary.fields("cusip_no")
svrDescr = rsSecSummary.fields("descr")
svrSecContact = rsSecSummary.fields("contact_id")
If backColor = "#b4beda" Then
backColor = "#ffffff"
Else
backColor = "#b4beda"
End If
%>
<tr align="left">
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecLpId%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecCusip%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrDescr%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecContact%></td>
</tr>
<%
li_index2 = li_index2 + 1
rsSecSummary.MoveNext
Loop
%>
</table>
</div>
</td>
</tr>
</table>
<%
End If
End IF
%>
</td>
</tr>
</table>
</div>
<IFRAME bgcolor="#c9c9c9" STYLE="DISPLAY: none; Z-INDEX: 100; LEFT: 110px; WIDTH: 645px; POSITION: absolute; TOP: 135px; HEIGHT: 298px" ID="frmeDetails" MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE frameborder=0 SCROLLING=no>
</IFRAME>
</form>
</BODY>
</html>[/ code ] but without the spaces inside those tags. I will fix it and post it for you!
here the code
Okay, the only things you need to do are to add the btnSubmitValidation function that I gave you before, get rid of or comment out the first submit button after security ID, then change the onclick of the second submit button to "return btnSubmitValidation()"
Here is the code, and what is highlighted was changed.
<html>
<head>
<link REL="stylesheet" TYPE="text/css" HREF="../css/art.css">
<META name=VI60_defaultClientScript content=VBScript>
<!--#include file= "t_head.asp"-->
<!--#include file="Utility.asp"-->
<!--#include file="Format.asp"-->
<!--#include file="standardLayout.asp"-->
<!--#include file="Customizerinc.asp"-->
<!--#include file="MenuUtility.asp"-->
<!--#include file="PssUtility.asp"-->
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Dim prevRowChosen
Dim prevRowChosenBgColor
Dim strArfSelected
Dim strPrevDetailsString
Sub window_onload
Dim li_index
Dim li_index2
prevRowChosen = ""
strArfSelected = ""
strPrevDetailsString = ""
If "<%=clickedButton%>" = "Submit" Then
'document.frmLpContacts2.cboGpOwner.value = "<%=strglpid%>" document.frmLpContacts2.txtLpId.value = "<%=svrLpId%>"
document.frmLpContacts2.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
If Len("<%=svrError%>") Then
If "<%=svrError%>" = "NotFound" Then
Msgbox "No matching data found for the specified search criteria.", ,"Search Error"
Exit Sub
Else
mainframeErrorBox("<%=svrError%>")
End If
Exit Sub
End If
setTabChosen(tabDetails)
setTabSunken(tabSummary)
wndSummary.style.visibility = "hidden"
wndDetails.style.visibility = "visible"
Else
setTabChosen(tabSummary)
setTabSunken(tabDetails)
document.frmLpContacts2.style.visibility = "visible"
document.frmLpContacts2.txtLpId.focus
wndSummary.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
End If
End Sub
Sub window_onunload
close_busy
End Sub
Sub tabDetails_onclick
strRetrieved = "<%=svrRetrieve%>"
If strRetrieved = "YES" Then
If BtnSubmitValidation() = True Then
setTabChosen(tabDetails)
setTabSunken(tabSummary)
wndSummary.style.visibility = "hidden"
wndDetails.style.visibility = "visible"
End If
End If
close_busy
End Sub
Sub tabSummary_onclick
setTabChosen(tabSummary)
setTabSunken(tabDetails)
wndSummary.style.visibility = "visible"
wndDetails.style.visibility = "hidden"
End Sub
Sub txtLpId_onkeypress
window.event.keyCode = Asc(UCase(Chr(window.event.keyCode)))
End Sub
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) = 0 And strO = 0 Then
Msgbox "Please type in a Security Number or choose from the Owner List.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Elseif Len(strL) > 0 And strO <> "0"
Msgbox "You cannot use both, Security Number and Owner List.", , "Input Validation"
document.acts2.txtLpId.focus
BtnSubmitValidation = False
Else
show_busy
BtnSubmitValidation = True
End If
End Function
'Function BtnSubmitValidation
'Dim strL
'Dim strA
'Dim strS
'document.frmacts2.txtLpId.value = Trim(document.frmacts2.txtLpId.value)
'strLpId = document.frmacts2.txtLpId.value
'If Len(strL) > 0 _
'And Len(strL) < 5 Then
'Msgbox "Security Number must be five characters in length.", , "Input Validation"
'document.frmacts2.txtLpId.focus
'BtnSubmitValidation = False
'Exit Function
'Elseif Len(strL) = 0 Then
'Msgbox "Security Number cannot be blank.", , "Input Validation"
'document.frmacts2.txtLpId.focus
'BtnSubmitValidation = False
'Exit Function
'End If
'show_busy
'BtnSubmitValidation = True
'End Function
'Function cboOValidation
'' Check to see if the user entered anything.
'If document.frmacts2.cboGpOwner.value = 0 Then
'MsgBox "You must enter an Owner before submitting."
'Exit Function
'End If
'If document.frmacts2.cboGpOwner.value = 1 Then
'strglpid = "AI"
'End If
'If document.frmacts2.cboGpOwner.value = 2 then
'strgplpid = "PAL"
'End If
'If document.frmacts2.cboGpOwner.value = 3 then
'strglpid = "OTHER"
'End If
'If document.frmacts2.cboGpOwner.value = 4 then
'strglpid = "UNKNOWN"
'End If
'show_busy
'cboGpOwnerValidation = True
''document.frmLpContacts2.submit
'End Function
Function inputCommaNumberOnly
If (window.event.keyCode < 48 Or window.event.keyCode > 57) _
And (window.event.keyCode <> 44) Then
window.event.keyCode = 0
End If
End Function
Function inputNumberOnly
If (window.event.keyCode < 48 Or window.event.keyCode > 57) Then
window.event.keyCode = 0
End If
End Function
Function toUpperCase
window.event.keyCode = Asc(UCase(Chr(window.event.keyCode)))
End Function
-->
</SCRIPT>
</head>
<BODY marginwidth = "0" marginheight = "0" topmargin=0 leftmargin=0 bgColor=white text=blue background=../nav/backgrnd.gif >
<%NavbarEx%>
<% call InitMenu()
call InitMainMenu()
call drawmenu ("GP Contacts","PLP.asp","",false,false)
call drawmenu ("LP Contacts","acts2.asp","",true,false)
call endMainMenu()
call initSubMenu()
call drawmenu ("Print","","Print",false,false)
call drawmenu ("Contact Us","","ContactUs",false,false)
call endSubMenu()
call endMenu()
%>
<form id="frmacts2" name="frmacts2" action="tacts2.asp?L1=home&L2=limpart&L3=" method="post">
<div id=divTab style="LEFT: 100px; WIDTH: 500px; POSITION: absolute; TOP: 98px; HEIGHT: 15px">
<table border=0 cellspacing=0 cellpadding=0 align="left">
<tr>
<td id="tabSummary" style="WIDTH: 175px; HEIGHT: 30px; BACKGROUND-COLOR: #b4beda" align="middle">Query</td>
<td id="tabDetails" style="WIDTH: 175px; HEIGHT: 30px; BACKGROUND-COLOR: #a9a9a9" align="middle">Contact</td>
</tr>
</table>
</div>
<div id="wndSummary" style="MARGIN-LEFT: 0px; POSITION: absolute; TOP: 53px">
<table bgcolor="#b4beda" width="655" height="100" border=0 cellspacing="0" cellpadding="0" align="left" class="main">
<tr align="middle" height=68>
<td colspan=3>
<table border="1" bgcolor="#b4beda" style="MARGIN-LEFT: 0px; WIDTH: 645px">
<TBODY>
<tr><td>
<table style="MARGIN-LEFT: 0px" border="0">
<TBODY>
<tr>
</tr>
<tr>
<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>
<input id="txtClicked" NAME="txtClicked" MAXLENGTH="6" style="WIDTH: 0px; COLOR: #000000; HEIGHT: 0px; BACKGROUND-COLOR: #c9c9c9; TEXT-ALIGN: left" readonly></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 ="Submit1" onmouseover ="this.style.backgroundColor = '#be6572'" onmouseout="this.style.backgroundColor = '#7e7ec9' " onclick="return BtnSubmitValidation();"></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>
</table></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</div>
<div id="wndDetails" style="MARGIN-LEFT: 0px; POSITION: absolute; TOP: 53px">
<table border=0 cellspacing="0" cellpadding="0" style="MARGIN-LEFT: 0px; WIDTH: 645px; HEIGHT: 296px" bgcolor="#b4beda" align="left" class="main">
<tr align="middle" valign="top">
<td colspan=4>
<%
If svrError <> "NotFound" Then
If svrMsgEmpty = "Empty" Then
%>
<table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9"><tr align="middle"><td align=middle height=20 colspan=2 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">
NO CONTACT FOR THIS LP
</td>
</tr>
</table>
<%
Elseif svrRetrieve = "YES" Then
%>
<table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9">
<table border=0 cellspacing="0" cellpadding="0" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: black 1px solid; WIDTH: 643px; BORDER-BOTTOM: black 1px solid" bgcolor="#c9c9c9">
<tr align="middle">
<td align=middle height=20 colspan=6 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">
LP CONTACTS
</td>
</tr>
<tr align="left">
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Security No.</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">LP Name</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Description</td>
<td align=middle height=20 width=96 style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; COLOR: #000000; BORDER-BOTTOM: black 1px solid">Contact Type</td>
<%
backColor = "#b4beda"
rsSecSummary.MoveFirst
li_index2 = 1
Do While Not rsSecSummary.EOF
svrSecLpId = rsSecSummary.fields("lp_id")
svrSecCusip = rsSecSummary.fields("cusip_no")
svrDescr = rsSecSummary.fields("descr")
svrSecContact = rsSecSummary.fields("contact_id")
If backColor = "#b4beda" Then
backColor = "#ffffff"
Else
backColor = "#b4beda"
End If
%>
<tr align="left">
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecLpId%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecCusip%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrDescr%></td>
<td align="left" bgcolor="<%=backColor%>" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN-LEFT: 0px; BORDER-LEFT: gray 1px solid; WIDTH: 105px; COLOR: #000000; BORDER-BOTTOM: gray 1px solid; HEIGHT: 20px"> <%=svrSecContact%></td>
</tr>
<%
li_index2 = li_index2 + 1
rsSecSummary.MoveNext
Loop
%>
</table>
</div>
</td>
</tr>
</table>
<%
End If
End IF
%>
</td>
</tr>
</table>
</div>
<IFRAME bgcolor="#c9c9c9" STYLE="DISPLAY: none; Z-INDEX: 100; LEFT: 110px; WIDTH: 645px; POSITION: absolute; TOP: 135px; HEIGHT: 298px" ID="frmeDetails" MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE frameborder=0 SCROLLING=no>
</IFRAME>
</form>
</BODY>
</html>
Thanks , the only issue is if strO = 0 then msgbox response should be : Owner can not be blank and if strL > 0 and strL < 5 then msgbox = security can not be < 5 characters....
Question:
How is this handled, are both fields required or just one, like either security ID or owner?
If only one of the two are required, I am sure you would like the security ID over the owner. The problem that you face with this is that you can only ask for one. strO will always = zero as long as strL has text. If strL doesn't have text, then strO can be changed. There's your dilema. If strL has no text, then you get an error, therefore strO is a secondary optional path.
Now, are both required, both allowed, or only one can be used? If both are required, then I'll redo the function for you. Otherwise, I believe it's the only way it can be.
i will change the value for strL = -1, that way the condition can be met using the btnSubmitValidation () you've given , only 1 field is required to populate the report. Will try Thanks again...
That fixed it. This problem is resolved
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.