除非发送textarea的“OtherText”值,否则一切正常。
HTML:
<label for="ReasonforRMA">Reason for RMA:</label>
<select name="ReasonforRMA" class="required" id="otherCheck">
<option value="">Choose an option</option>
<option value="Wrong Item">Wrong Item</option>
<option value="Defective">Defective</option>
<option value="Unit Damaged">Unit Damaged</option>
<option value="Other">Other</option>
</select><br />
<label for="OtherText" id="otherLabel">Other Reason:</label>
<textarea name="OtherText" id="otherText"></textarea><br />
jQuery的:
var textarea = $('#otherText');
var textlabel = $('#otherLabel');
textarea.hide();
textlabel.hide();
$('#otherCheck').change(function(){
var select = $(this).val();
if (select == 'Other'){
textlabel.show();
textarea.show();
}
else {
textlabel.hide();
textarea.hide();
}
});
ASP:
<%
'declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim DealerName
Dim DealerNumber
Dim InvoiceNumber
Dim PONumber
Dim InvoiceDate
Dim ModelNumber
Dim SerialNumber
Dim ReasonforRMA
Dim OtherText
Dim ConditionofUnit
' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "myemail@email.com"
Subject = "Online RMA Submission"
DealerName = Trim(Request.Form("DealerName"))
DealerNumber = Trim(Request.Form("DealerNumber"))
InvoiceNumber = Trim(Request.Form("InvoiceNumber"))
PONumber = Trim(Request.Form("PONumber"))
InvoiceDate = Trim(Request.Form("InvoiceDate"))
ModelNumber = Trim(Request.Form("ModelNumber"))
SerialNumber = Trim(Request.Form("SerialNumber"))
ReasonforRMA = Trim(Request.Form("ReasonforRMA"))
OtherText = Trim(Request.Form("OtherText"))
ConditionofUnit = Trim(Request.Form("ConditionofUnit"))
' prepare email body text
Dim Body
Body = Body & "Dealer Name: " & DealerName & VbCrLf
Body = Body & "Dealer Number: " & DealerNumber & VbCrLf
Body = Body & "Invoice Number: " & InvoiceNumber & VbCrLf
Body = Body & "PO Number: " & PONumber & VbCrLf
Body = Body & "Invoice Date: " & InvoiceDate & VbCrLf
Body = Body & "Model Number: " & ModelNumber & VbCrLf
Body = Body & "Serial Number: " & SerialNumber & VbCrLf
Body = Body & "Reason for RMA: " & ReasonforRMA & VbCrLf
Body = Body & "Other Text: " & OtherText & VbCrLf
Body = Body & "Condition of Unit: " & ConditionofUnit & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
' send confirmation
Dim mailC
Set mailC = Server.CreateObject("CDONTS.NewMail")
mailC.To = EmailFrom
mailC.From = "ouremail@email.com"
mailC.Subject = "Confirmation of your RMA Submission"
mailC.Body = "Test Confirmation"
mailC.Send
' redirect to success page
Response.Redirect("complete.html")
%>
它正在发送除“OtherText”textarea值之外的所有内容。我猜它只是一个错字或者某个地方,但我看不到任何东西!!
答案 0 :(得分:2)
作为一个良好的编码问题,您应该在这些表单HTML字段上使用名称和ID的EXACT相同字符串。这将避免潜在的混淆。
由于各种原因,ASP可能(错误地)使用ID属性作为变量名而不是name属性。