我在尋找使用cfpdfform
將cfform
中的表單值傳遞給PDF。這裏是我的小測試頁面,循環訪問50條記錄來拉取姓氏和名字。我試圖把它們拉入pdf領域。目前它將所有50個名字放入firstname字段中,並將所有lastname放入pdf的lastname字段中。我沒有與提交按鈕結婚,但有什麼更好的選擇?ColdFusion - 使用帶多個字段和多個提交按鈕的cfloop
在我的最後一次迭代中,我將拉入大約100個字段。
--Form--
<cfform name="autopdf" method="POST" action="automated_pdf_submit.cfm" enctype="multipart/form-data">
<h1>Select a state to insert into a PDF form</h1>
<div class="center">
<select name="pdfselect" id="pdfselect">
<option value="" selected>--Select State--</option>
<option value="FROI_NY.pdf">New York</option>
<option value="FROI_PA.pdf">Pennsylvania</option>
</select>
<cfinput type="hidden" name="statevalidate" onValidate="yourFunction"
message="YOU MUST SELECT A STATE TO CONTINUE!">
</div>
<table align="center" style="width:400px">
<tr>
<th></th>
<th>First Name</th>
<th>Last Name</th>
<th>Export to PDF</th>
</tr>
<cfoutput>
<cfloop query="#qryPersons#" startrow="1" endrow="50" >
<tr class="#IIf(CurrentRow Mod 2, DE('rowOdd'), DE('rowEven'))#" onmouseover="this.className='rowHighlight'"
<cfif CurrentRow Mod 2>onmouseout="this.className='rowOdd'"
<cfelse>onmouseout="this.className='rowEven'"</cfif>>
<td>#qryPersons.CurrentRow#</td>
<td>#qryPersons.LastName#</td>
<input type="hidden" name="FirstName" value="#qryPersons.LastName#">
<td>#qryPersons.FirstName#</td>
<input type="hidden" name="LastName" value="#qryPersons.FirstName#">
<td style="width:50px"><input type="submit" value="Create PDF"</td>
</tr>
</cfloop>
</cfoutput>
</table>
</cfform>
--Action--
<cfpdfform action="populate" source="forms\#form.pdfselect#">
<cfpdfformparam name="FirstName" value="#form.FirstName#">
<cfpdfformparam name="LastName" value="#form.LastName#">
</cfpdfform>
這裏有什麼問題?這聽起來像是你的問題正在起作用。 – Busches 2013-02-22 16:33:54
@Busches它將所有的名字拉入表單。這裏是頁面和PDF格式的圖片:http://imgur.com/KZ4HEiE,VIjlgDz – Macness 2013-02-22 16:37:56
啊,那麼馬特的答案會解決你的問題。 – Busches 2013-02-22 16:38:47