2014-10-15 2 views
1

여러 가지 옵션이있는 선택 상자가있는 양식이 있습니다. 사용자가 특정 옵션을 선택하면받는 사람의 전자 메일 주소를 원합니다.ASP 형식 선택 옵션을 선택한 경우 전자 메일 주소를 변경하십시오.

여기에 일종의 ASP 의사 코드가 있습니다. 양식에서 데이터를 가져 오는 데 도움이 필요합니다. 그렇게하기 위해 jQuery/JavaScript를 사용해야합니까, 아니면 다른 방식입니까?

<% 
Dim selectedoption 
Dim specialoption 

if selectedoption="specialoption" then #this would pull data from form 
varrecipient = "[email protected]" #this would pull data from form 

else 

varrecipient = "[email protected]" 

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> &#8225;</sup></label> 
<input name="sFName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sFName")) %>"> 

<label>Last Name<sup> &#8225;</sup></label> 
<input name="sLName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sLName")) %>"> 

<label>Company/ Organization<sup> &#8225;</sup></label> 
<input name="sCName" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sCName")) %>" > 

<label>Company Type<sup> &#8225;</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> &#8225;</sup></label> 
<input name="sEmail" type="text" size="40" value="<%= Server.HTMLEncode(Request.Form("sEmail")) %>" > 

<input type="submit" class="fbutton" value="Send" /> 

</form> 
+1

왜 우리에게 PseudoCode를 제공합니까?, 실제로 코딩하지 않는 이유는 무엇입니까? 의사 코드를 사용하면 중요한 세부 사항을 전달하게됩니다 ... 오직 주석. – Rafael

+0

내가 내 게시물에서 말했듯이, 나는 코드를 모른다. 그것은 전체 질문이다. –

+0

얼마나 많은 이메일 주소가 있는지에 따라 jQuery를 사용할 수도 있습니다. 당신은 좋은 시작을 위해 여기를 볼 수 있습니다 : http://stackoverflow.com/questions/11179406/jquery-get-value-of-select-onchange –

답변

0

그냥 요청 객체를 사용합니다. 예를 들어 SCtype 선택이 관련 수신자 주소를 결정하기 위해 사용하려는 경우이 옵션을 사용할 수 있습니다.

<% 
If Request.Form("sCType") = "Brand" or Request.Form("sCType") = "Retailer" then 
varrecipient = "[email protected]" 
Else 
varrecipient = "[email protected]" 
End If 
%> 
관련 문제