Form action problem

H

Horhayson

Trying to fix a web site I inherited. Problem is with the *help* page.
User fills out form and hits send. The browser comes back with Error
Number 424, Error Description Object Required, Key Name Comments.

Code follows (I replaced <> with *)
*td valign="top" align="left" width="150"*
*form action="[email protected]?subject=Web
Comments" method="post"*
Your Name:
*/td*
*td valign="top" align="left" width="150"*
*input type="text" name="Fullname" size="20" maxlength="100"*
*/td*
*/tr*
*tr*
*td valign="top" align="left" width="150"*
Company:
*/td*
*td valign="top" align="left" width="150"*
*input type="text" name="Company" size="20" maxlength="100"*
*/td*
*/tr*
*tr*
*td valign="top" align="left" width="150"*
Email:
*/td*
*td valign="top" align="left" width="150"*
*input type="text" name="Email" size="20" maxlength="100"*
*/td*
*/tr*
*tr*
*td valign="top" align="left" width="150"*
Comments:
*/td*
*td valign="top" align="left" width="150"*
*textarea cols="20" rows="8" name="Comments"**/textarea*
*/td*
*/tr*
*tr*
*td valign="top" align="left" width="150"*
*br*
*input type="submit" name="submit" value="Send" onClick="helpThanks()"*
*/td*
*td valign="top" align="left" width="150"*
*br*
*input type="Reset" value="Reset Form"* */form*
*/td*
*/tr*
*/table*
 
R

Ray at

We'd need to see the code in helpsend.asp, not the HTML of the page that
GETs to that page. Oh, wait, it posts with a querystring. That's
different. Did you inherit this from an ex-employee?

Ray at work
 
W

WIlliam Morris

Looks like a really poorly made form...

Try this:

<form action="helpsend.asp">
<input type="hidden" name="sendto" value="(e-mail address removed)">
<input type="hidden" name="subject" value="web comments">
 
H

Horhayson

Here is the code to helpsend.asp. Yes, the employee is no longer with
the company, so I have to attempt to get into his thought processes.


<% Response.Buffer = True

On Error Resume Next

Function URLDecode(strToDecode)
strIn = strToDecode
strOut = ""
intPos = InStr(strIn, "+")
Do While intPos
strLeft = ""
strRight = ""
If intPos > 1 Then strLeft = Left(strIn, intPos - 1)
If intPos < Len(strIn) Then strRight = Mid(strIn, intPos + 1)
strIn = strLeft & " " & strRight
intPos = InStr(strIn, "+")
intLoop = intLoop + 1
Loop
intPos = InStr(strIn, "%")
Do While intPos
If intPos > 1 Then strOut = strOut & Left(strIn, intPos -1)
strOut = strOut & Chr(CInt("&H" & Mid(strIn, intPos + 1, 2)))
If intPos > (Len(strIn) - 3) Then
strIn = ""
Else
strIn = Mid(strIn, intPos + 3)
End If
intPos = InStr(strIn, "%")
Loop
URLDecode = strOut & strIn
End Function

Set objResult = Server.CreateObject("Scripting.Dictionary")

strQuery = Request.Form

intSep = InStr(strQuery, "&")
Do While intSep
strKey = ""
strValue = ""
strNVPair = Left(strQuery, intSep - 1)
strQuery = Mid(strQuery, intSep + 1)
intEqu = InStr(strNVPair, "=")
If intEqu > 1 Then strKey = URLDecode(Left(strNVPair, intEqu - 1))
If intEqu < Len(strNVPair) Then strValue = URLDecode(Mid(strNVPair,
intEqu + 1))
objResult.Add strKey, strValue
strErrorName = strKey
intSep = InStr(strQuery, "&")
Loop
strKey = ""
strValue = ""
intEqu = InStr(strQuery, "=")
If intEqu > 1 Then strKey = URLDecode(Left(strQuery, intEqu - 1))
If intEqu < Len(strNVPair) Then strValue = URLDecode(Mid(strQuery,
intEqu + 1))
objResult.Add strKey, strValue

Dim strToEmail
strToEmail = "-----------------------------" & vbNewLine & "Help Page
Feedback"
strToEmail = strToEmail & vbNewLine & "-----------------------------" &
vbNewLine & vbNewLine
strKeysArray = objResult.Keys
strItemsArray = objResult.Items
For intLoop = 0 To objResult.Count - 1
strThisKey = strKeysArray(intLoop)
strThisItem = strItemsArray(intLoop)
strToEmail = strToEmail & strThisKey & " = " & strThisItem & vbNewLine
Next

strSendToEmail = Request.QueryString("sendto")


Set mailer = Server.CreateObject("ASPMAIL.ASPMailCtrl.1")
temp = mailer.SendMail("somemailserver.com", strSendToEmail, "ACC Site
Visitor", "Comments about the site", strToEmail)

If Err.Number = 0 then
Response.Redirect("help-page.asp")
Else
If Err.Number = 457 Then
Response.Write("The form that is being submitted uses the same name
for ")
Response.Write("more than one form element, please contact <a
href='" & strSendToEmail & "'>")
Response.Write( strSendToEmail & "</a> to have this error fixed." &
vbNewLine )
Else
Response.Write("<DIV>Error Number: '" & Err.Number & "'<BR>")
Response.Write("Error Description: '" & Err.Description & "'<P>")
Response.Write("Key Name: '" & strErrorName & "'<BR>")
Response.Write("<B>There was a problem processing your form. Click
the back button and try it again please.<BR><BIG>Mills
Publishing</BIG></B></DIV>")
End If
End If
%>
 
R

Ray at

Okay, and on what line is the error?

If I were you, I'd redo this form from scratch. All this querystring
nonsense in the method=post is odd. Also, what's with the urldecode
function? Why? And why is this person parsing the form collection himself?
Odd.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,132
Messages
2,570,775
Members
47,332
Latest member
datacos561

Latest Threads

Top