我的表单有一个包含多个不同选项的选择框。如果用户选择某个选项,我想要收件人的电子邮件地址。
这是某种ASP伪代码,我只需要帮助从我的表单中获取数据。我是否需要使用jQuery / JavaScript来实现,或者采用不同的方式?
<%
Dim selectedoption
Dim specialoption
if selectedoption="specialoption" then #this would pull data from form
varrecipient = "ImSpecial@domain.com" #this would pull data from form
else
varrecipient = "NotSoSpecial@domain.com"
else if
varFormName = "ContactFormName"
varRHBusinessUnit = "Business1"
varLanguage = "ENGLISH"
varCourtesyResponse = "Y"
varRedirect = "#noredir?formRun=true"
varSubject = "Subject of my Form"
%>
FORM:
<form style="width: 530px;" method="post" name="contactFormName" enctype="application/x-www-form-urlencoded" onsubmit="return validateForm()">
<input type="hidden" name="Redirect" value="/thankyou.htm" />
<input type="hidden" name="Subject" value="Subject of my form" />
<label>First Name<sup> ‡</sup></label>
<input name="sFName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sFName")) %>">
<label>Last Name<sup> ‡</sup></label>
<input name="sLName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sLName")) %>">
<label>Company/ Organization<sup> ‡</sup></label>
<input name="sCName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sCName")) %>" >
<label>Company Type<sup> ‡</sup></label>
<select name="sCType">
<option value="Brand">Brand</option>
<option value="Retailer">Retailer</option>
<option value="Converter">Converter</option>
<option value="Other">Other</option>
</select>
<label>Email<sup> ‡</sup></label>
<input name="sEmail" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sEmail")) %>" >
<input type="submit" class="fbutton" value="Send" />
</form>
答案 0 :(得分:0)
只需使用请求对象即可。例如,如果您要使用SCtype select来确定相关的收件人地址,那么您可以使用它。
<%
If Request.Form("sCType") = "Brand" or Request.Form("sCType") = "Retailer" then
varrecipient = "ImSpecial@domain.com"
Else
varrecipient = "NotSoSpecial@domain.com"
End If
%>