Jump to content
Sign in to follow this  
mboehler3

2 Forms On 1 Page Won't Load

Recommended Posts

I am trying to put two forms on one page – one is a login form that asks for a username and password, and the other form requests information that triggers an email send. For some reason, the page won’t load when I place the logic for both forms on the page. My login form has code that looks like this:

<form action="/accountants/" method="post" name="frmMain" class="Login" id="Form1" onSubmit="pageTracker._setVar(Accountant);"><input name="action" value="Edit" type="hidden" /><input name="partnerCode" value="" type="hidden" /><div class="acct-field"><input id="Text1" name="UserName" size="24" maxlength="50" tabindex="1" value="Username" onfocus="if(this.value == 'Username') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Username';}" /></div><div class="acct-field"><input id="Password1" name="Password" size="24" maxlength="20" type="password" tabindex="2" value="Password" onfocus="if(this.value == 'Password') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Password';}" /></div><input src="/images/960/accountant/form/acct_login.png" name="Submit" value="Submit" type="image" style="width:110px;height:31px;padding-right:10px" align="right" /></form>

And behind the scenes, this code makes it work:

<object RUNAT="SERVER" ID="oUser" PROGID="zUser.user"></object><object RUNAT="SERVER" ID="oPartner" PROGID="zPartners.partners"></object><object RUNAT="SERVER" ID="oErrors" PROGID="zErrorHandler.Errors"></object><object RUNAT="SERVER" ID="oLog" PROGID="zLog.Log"></object><object RUNAT="SERVER" ID="oLogin" PROGID="zLogin.Login"></object><object RUNAT="SERVER" ID="oUserSession" PROGID="zUserSession.UserSession"></object><object RUNAT="SERVER" ID="oCode" PROGID="zUtils.Code"></object><% Option ExplicitIf Application.Contents("debug") <> "YES" ThenOn Error Resume NextEnd If%><!-- #include virtual = "/Include/CheckRedirect.asp" --><%'=====================================================================================' Checks for IP/URLs that should not land on the SurePayroll Brochureware pages.' The CheckRedirect include contains all the code for checking the IP/URLs and' handling the actual redirect.'=====================================================================================  if CheckRedirect thenend if %><!-- #include virtual = "/Include/pageAvail.asp" --><!-- #include virtual = "/Include/skinsdata.asp" --><!-- #include virtual = "/Include/SessionManagement.asp" --><!-- #include virtual = "/include/validate.asp" --><!-- #include virtual = "/Include/errorHandler.asp" --><!-- #include virtual = "/Include/ShowMediaTag.asp" --><!-- #include virtual = "/webglobals.asp" --><%'Read TAP partnerCode cookie'If it exists, read data into input fields'User information fields only available if the passed PC = "TAP"'== Declaration  ==============================================================dim sBCL_code, lEmployeeID, iAccessLevel, lLoginCountdim lSkinID, lEmailID, lPromoIDdim oRS, v, sAction, bResult, sdim lUserKey, sUserName, sPassword, sPartnerCode, lLoginIDdim thisURLSecureDim secLoginID		  'Security SecLoginID from tblSecLoginDim secUserTypeID  'Security SecUserTypeID from tblSecUserTypeDim iLogLoginTypeID  'Login type LogLoginTypeID from tblLogLoginTypesDim bSuccessDim sRedirectPageDim bIsPartnerUserDim iStep, sPageName, rsSteps, rsCodesDim sEncryptionTypeDim rsListDim sUrlPrefix'== Initialization ============================================================EnsureLoginSSL()sUrlPrefix = GetHttpUrlPrefix()secUserTypeID = 2 'Payroll useriLogLoginTypeID = 6 'Partner loginthisURLSecure = "https://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")set oRS = server.CreateObject("ADODB.recordset")sAction = RestrictFilter(Request.Form("action"),f_alphanumeric,50)lUserKey = 0: lSkinID  = 0: lEmailID = 0: lPromoID = 0: sBCL_code = "": sPartnerCode=""'==============================================================================If sAction = "Edit" thenvalidateUserElseEndUserSessionEnd ifSub validateUsersUserName = RestrictFilter(trim(Request.Form("username")), f_login_name, 50)sPassword = RestrictFilter(trim(Request.Form("password")), f_login_password, 50)if len(sUserName) = 0 then  oErrors.Add "userName", "User name", "You must provide a user name."end ifif len(sPassword) = 0 then  oErrors.Add "password", "password", "You must provide a password."end if	  ' EB June 17 2008 added case sensitivity implementation	 call oLogin.GetLoginIDByUserNameAndUserType(sUserName, secUserTypeID, secLoginID)		 bResult = oLogin.GetSecLoginInformationByLoginId(secLoginID, secUserTypeID, rsList) 	 ' Set Variables from Recordset	 If Not rsList.EOF then		   sEncryptionType = rsList("EncryptionTypeId")	 else		    ' default: 2 - Case sensitive 1 - No case sensitive		   sEncryptionType = 2	 end if 			 set rsList = nothingif oErrors.Count = 0 then  'confirm that the user and password is correct  'lUserKey = oUser.ValidateUser(cstr(sUserName), cstr(sPassword))  lUserKey = oUser.ValidateUserWithEncryptType(cstr(sUserName), sEncryptionType, cstr(sPassword))end if If lUserKey > 0 Then  'Make log entry   'First retrieve the secLoginID  call oLogin.GetLoginIDByUserNameAndUserType(sUserName, secUserTypeID, secLoginID)     call oLog.AddLogLogin(secLoginID, sBCL_code, iLogLoginTypeID, secUserTypeID, Request.ServerVariables("REMOTE_ADDR"), sUserName, 1)	  Else  'Make log entry - unsuccessful		 	 call oLogin.GetLoginIDByUserNameAndUserType(sUserName, secUserTypeID, secLoginID)     call oLog.AddLogLogin(secLoginID, 0, iLogLoginTypeID, secUserTypeID, Request.ServerVariables("REMOTE_ADDR"), sUserName, 0)	End If   	'============= CHECK FOR ERROR ==================if err.number <> 0 then bResult = SetErrorInfo (1, sBCL_CODE, lEmployeeID)'=========== END CHECK FOR ERROR ================'==========================================================================    '=== Check if login was restricted by program domain ======================    '=== GM added july 3 2008 - lock down by domain    Dim rsDomainValidGetDomainValidatedByBCLAndUserType sBCL_CODE, secUserTypeID, rsDomainValidif rsDomainValid.BOF And rsDomainValid.EOF then	 oErrors.Add "Domain Restricted", "Login Restricted By Domain", _   "You can not login using this domain name.  Contact your payroll administrator." end if   if oErrors.Count = 0 then  if lUserKey = 0 then   'validation failed   bResult = oUser.GetUserInfo(oRS,0, , , sUserName)   '============= CHECK FOR ERROR ==================   if err.number <> 0 then bResult = SetErrorInfo (2, sBCL_CODE, lEmployeeID)   '=========== END CHECK FOR ERROR ================   if oRS.State = adStateOpen then    if not (oRS.BOF or oRS.EOF) then	 lUserKey = oRS("userkey")	 oRS.Close	 if lUserKey > 0 then	  'increment failed login count	  'bResult = oUser.setUserInfo(lUserKey, oErrors,,,,,,,,,,,1)		  bResult = oUser.SetUserInfoWithEncryptType(lUserKey, oErrors, sEncryptionType,,,,,,,,,,,1)	  '============= CHECK FOR ERROR ==================	  if err.number <> 0 then bResult = SetErrorInfo (3, sBCL_CODE, lEmployeeID)	  '=========== END CHECK FOR ERROR ================	 end if	 oErrors.Add "password","Password","Either the password or username is incorrect."    else	 oErrors.Add "password","Password","Either the password or username is incorrect."    end if   else    oErrors.Add "password","Password","Either the password or username is incorrect."     end if  else   'get other values from tblUsers   bResult = oUser.GetUserInfo(oRS, 0, ,,,lUserKey)   '============= CHECK FOR ERROR ==================   if err.number <> 0 then bResult = SetErrorInfo (4, sBCL_CODE, lEmployeeID)   '=========== END CHECK FOR ERROR ================   if oRS.State = adStateOpen then    if not (oRS.BOF or oRS.EOF) then	 iAccessLevel = oRS("accessLevel")	 sPartnerCode = trim(oRS("partnerCode"))	 sBCL_code = oRS("bcl_code")	 lLoginCount = oRS("loginCount")	 oRS.Close    end if   end if    set oRS = nothing   if lLoginCount < 10 then	 If oUserSession.IsPartnerAccessLevel(CLng(iAccessLevel), bIsPartnerUser) Then	   if bIsPartnerUser then	   'set a new session id	   bResult = AddNewSessionV5("", sPartnerCode, 0, iAccessLevel, secLoginID, secUserTypeID)  'sBCL_code, iE1_id, iAccess_Level	   'set userkey and partner code to session detail	   lLoginID = request.Cookies("TAP")					  call oUser.setSessionDtlV2(lLoginID, "USERKEY99", lUserKey)	   setSessionDtl lLoginID, "USERKEY", lUserKey	   setSessionDtl lLoginID, "PARTNERCODE", sPartnerCode  	   if sPartnerCode = "TAP" then	    Response.Redirect "/SureChoice/enrollment/incomplete.asp"	   else	    'has this trusted advisor completed enrollment sufficiently?	    bResult = oPartner.isReferralPartnerCompleted(sPartnerCode, sRedirectPage, oErrors)	   	    '============= CHECK FOR ERROR ==================	    if not bResult then bResult = SetErrorInfo (5, sBCL_CODE, lEmployeeID)	    '=========== END CHECK FOR ERROR ================   	    if oErrors.Count = 0 then	  		 'Redirect user to the client list or for incomplete enrollments go to the		 'appropriate Enrollment page				 'Get enrollment step and page to redirect to				 bResult = oPartner.getPartnerEnrollmentStep (sPartnerCode, rsSteps)				 If bResult and rsSteps.State = adStateOpen Then				 If not rsSteps.EOF Then				 iStep = rsSteps("EnrollmentStep")				 		 If isNull(iStep) Then		  iStep = 0		 End If		 End If				 		 End If						 '70 is a completed enrollment				 If iStep = 70 Then						 	    Response.Redirect "/SPF/SureChoice/default.aspx"	   		 'Anything else is an incomplete enrollment		 Else	    'Look up the page from the Codes table to redirect to	    bResult = oCode.getCodeGroup (rsCodes, "PartnerEnroll")	   	   	    If bResult and rsCodes.State <> 0 Then				  		 While not rsCodes.EOF					 		  If Trim(rsCodes("code_val")) = Trim(iStep) Then			   		   sPageName = Trim(rsCodes("code_desc"))		  		   Response.Redirect sPageName		   		  End If		   		  rsCodes.MoveNext	   		 Wend				 set rsCodes = nothing	    End If													 		  		 End If	    else		 Response.Redirect sRedirectPage	    end if ' errors count = 0	   end if 'TAP partner code	 else	   oErrors.Add "username", "User name", "Password or username is invalid."   	 end if 'accesslevel = 5    Else	 bResult = SetErrorInfo (6, sBCL_CODE, lEmployeeID)    End If 'Is Partner Access Level   else    oErrors.Add "username", "User name", "There have been too many failed attempts to login."   end if  End ifend if	  End Sub'== Exit Procedures ==========================================================='=============================================================================='== ASP Procedures ============================================================Sub ErrorHandlerIf oErrors.Count > 0 Then  Dim e  Response.Write "Login Error: "  For Each e In oErrors   Response.Write e.Description  NextEnd IfEnd Sub'This is used to delcare the page name for the navbar style to be correctdim PageNamePageName = "CPSHome"%><!-- #include virtual = "/webglobals960.asp" -->

Additionally, the info request form looks like this:

<form action="http://now.eloqua.com/" method="post" name="referaclient" onSubmit="return checkrefervalues();"><input type="hidden" name="sendemail" value="rac">  <%if sendemail = "rac" and refererror <> "" ThenIf refererror = "missinginfo" then Response.Write ("<p class='inputboxheaders error'><strong>Error - You are missing information, please answer all of the questions below so that we may better serve you.</strong>") end ifIf refererror = "dataintegrity" then Response.Write ("<p class='inputboxheaders error'><strong>Error - There was a problem with some of your answers, please try again.</strong>") end ifend If%><div class="acct-field"><input id="firstname" name="LastName" size="24" maxlength="50" tabindex="1" value="First Name*" onfocus="if(this.value == 'First Name*') {this.value = '';}" onblur="if (this.value == '') {this.value = 'First Name*';}" /></div><div class="acct-field"><input id="lastname" name="LastName" size="24" maxlength="50" tabindex="1" value="Last Name*" onfocus="if(this.value == 'Last Name*') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Last Name*';}" /></div><div class="acct-field"><input id="company" name="Company" size="24" maxlength="50" tabindex="1" value="Company*" onfocus="if(this.value == 'Company*') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Company*';}" /></div><div class="acct-field"><input id="email" name="emailAddress" size="24" maxlength="50" tabindex="1" value="Email*" onfocus="if(this.value == 'Email*') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Email*';}" /></div><div class="acct-field"><input id="phone" name="businessPhone" size="24" maxlength="50" tabindex="1" value="Phone*" onfocus="if(this.value == 'Phone*') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Phone*';}" /></div><div class="fontsize12"><strong>Select Interest</strong></div><input type="radio" name="cPAPartnerType" value="Reseller" />Reseller Program<br /><input type="radio" name="cPAPartnerType" value="Referrer" />Referral Program<br /><input type="radio" name="cPAPartnerType" value="Reports View Access Only" />Client View Access<br /><input type="radio" name="cPAPartnerType" value="General Interest" />All Programs<div class="fontsize12 lineheight18 tpadding10"><strong>Subscribe</strong></div><input type="checkbox" name="pMIOptIn" value="Yes" checked="yes" />Newsletter<input src="/images/960/accountant-center/form/partnership-submit.jpg" class="rpadding10 tpadding10" name="Submit" value="Submit" type="image" align="right" /><input type="hidden" name="referralCode" value="<% =fm_refcode%>"><input type="hidden" name="elqFormName" value="ACCT_CenterWebPages"><input type="hidden" name="elqSiteID" value="2470"><input type="hidden" name="elqCustomerGUID" value=""><input type="hidden" name="elqCookieWrite" value="0"><input type="hidden" name="pageURL" value="http://<%= request.serverVariables("SERVER_NAME") %><%= request.serverVariables("URL") %>"></form>

And has this code:

<%  'declare vars for sending email  Dim bReturn, dtSendDate  Dim sMailSubject, sMailBody, sMailFromAddress, sMailFromName, sMailToAddress, sMailToName  dim sendemail,emailbodytext,refererror  sendemail = ""  sendemail = Request("sendemail")  refererror = ""   Function IllegalChars(sInput)    Dim sBadChars, iCounter    IllegalChars=False    sBadChars=array("drop", "--", "insert", "delete", "xp_", "#", "%","(", ")", "/", "\", ":", ";", "<", ">", "=", "[", "]", "?", "`", "|")    For iCounter = 0 to uBound(sBadChars)	 If Instr(sInput,sBadChars(iCounter))>0 Then	  IllegalChars=True	 End If    Next   End function     If sendemail = "rac" Then    dim str_name, str_companyname, str_phone, str_email, ephonelen, str_refname, str_refcompanyname, str_refphone, str_refemail, str_terms	 	  str_subscribeid = Request("subscribeid")   str_name = Request("name")   str_companyname = Request("companyname")   str_email = Request("email")   str_enewsletter = Request("enewsletter")   str_printnewsletter = Request("printnewsletter")     if (str_name = "Your Name") or (str_email = "") or (str_companyname = "Your Company") then	 refererror = "missinginfo"   end if     If IllegalChars(str_name)=True OR IllegalChars(str_email)=True Then    refererror = "dataintegrity"   End If      if refererror = "" then 	 emailbodytext = "subscribeid | name | company | email | enewsletter | printnewsletter | " & Request("subscribeid") & " | " & Request("name") & " | " & Request("companyname") & " | " &  Request("email") & " | " &  Request("enewsletter") & " | " &  Request("printnewsletter")    dtSendDate = Now()	 sMailSubject = "PMI Subscription - Accountant Client Capture"		    sMailBody = emailbodytext		    sMailFromAddress = "webmaster@surepayroll.com"    sMailFromName = "Webmaster"    sMailToAddress = "AccountantInfo@surepayroll.com"    sMailToName = "Francesca Zelasko"    bReturn = oCustServ.SendMessage("----", 99, sMailFromAddress, sMailFromName, sMailToAddress, sMailToName, sMailBody, sMailSubject, dtSendDate)    '============= CHECK FOR ERROR ==================    if bReturn = False then bReturn = SetErrorInfo (1, "----", 0)    '=========== END CHECK FOR ERROR ================    End If   End If %>

When I put all of this code on the same page, I get an error that reads:

Microsoft VBScript compilation error '800a0411'Name redefined/Include/960/accountant/form_partnership.asp, line 3Dim bReturn, dtSendDate----^

I’m not an expert in ASP, so I’m not sure if the problem is obvious and I’m just not seeing it. Either way, is there any solution that will allow me to have both forms on the same page? Thanks in advance for any help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...