0

除了没有发送文本区域的“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”文本区域值之外的所有内容。我猜它只是一个错字或某处的东西,但我什么都看不到!

4

1 回答 1

2

作为良好编码的问题,您应该在这些表单 HTML 字段中使用完全相同的字符串作为名称和 id。它将避免潜在的混乱。

ASP 有可能由于其自身的原因(不正确地)使用 ID 属性作为变量名而不是 name 属性。

于 2012-11-13T14:43:19.623 回答