2017-03-14 22 views
0

繼承人我的代碼:獲取輸出到電子郵件的收音機/複選框的值?

<cfparam name='form.firstName' Default=''> 
<cfparam name='form.yes' Default=''> 
<cfparam name='form.no' Default=''> 
<cfparam name='form.clean' Default=''> 
<cfparam name='form.light' Default=''> 
<cfparam name='form.heavy' Default=''> 
<cfparam name='form.superheavy' Default=''> 

<label for="firstName">Guest Access:</label> 
<input type="textbox" name="firstName" value="#form.firstName#"> 

<label for="allkeysaccountedfor">All keys are accounted for?:</label> 
<select> 
    <option value="#form.yes#" name="yes">Yes</option> 
    <option value="#form.no#" name="no">No</option> 
</select> 

<label for="unitcondition">Unit Condition?:</label> 
    <input type="radio" name="clean" value="#form.clean#"><span>Clean</span> 
    <input type="radio" name="light" value="#form.light#"><span>Light</span> 
    <input type="radio" name="heavy" value="#form.heavy#"><span>Heavy</span> 
    <input type="radio" name="superheavy" value="#form.superheavy#"><span>SuperHeavy</span> 

當我提交表單,我收到一封電子郵件回我把在文本框中,但是當我檢查是或否或選擇單選按鈕的選項,沒有得到在電子郵件中返回。任何意見將不勝感激謝謝!

+1

很難說沒有看到電子郵件代碼。 – Leigh

+0

我在底部的解決方案涵蓋此:http://stackoverflow.com/questions/35299944/sending-cf-mail-from-a-static-page-to-single-recipient –

+0

可能的重複[發送cf郵件從a靜態頁面單個收件人](http://stackoverflow.com/questions/35299944/sending-cf-mail-from-a-static-page-to-single-recipient) –

回答

0

您正在爲選擇按鈕和單選按鈕設置選項中的名稱屬性。我會嘗試將它設置爲像這樣的父元素:

<cfparam name='form.firstName' default=''> 
<cfparam name='form.allkeysaccountedfor' default=''> 
<cfparam name='form.unitcondition' default=''> 

<label for="firstName">Guest Access:</label> 
<input type="textbox" id="firstName" name="firstName" value="#form.firstName#"> 

<label for="allkeysaccountedfor">All keys are accounted for?:</label> 
<select name="allkeysaccountedfor" id="allkeysaccountedfor"> 
    <option value="yes" <cfif allkeysaccountedfor eq "yes">selected</cfif>>Yes</option> 
    <option value="no" [[do the same for no here]] >No</option> 
</select> 

<label for="unitcondition" id="unitcondition">Unit Condition?:</label> 
<input type="radio" name="unitcondition" value="clean" <cfif unitcondition eq "clean">checked</cfif>><span>Clean</span> 
<input type="radio" name="unitcondition" value="light" [[do the same for this value]] ><span>Light</span> 
<input type="radio" name="unitcondition" value="heavy" [[do the same for this value]] ><span>Heavy</span> 
<input type="radio" name="unitcondition" value="superheavy" [[do the same for this value]] ><span>SuperHeavy</span> 

然後,在您的電子郵件中,我會查找上面的3個表單變量。另請注意,我在您的HTML元素中添加了「id's」。這是因爲標籤中的「for」屬性指定了標籤所綁定的表單元素,並使用「id」屬性來執行該操作。

相關問題