【发布时间】:2013-02-22 16:26:19
【问题描述】:
我希望使用cfpdfform 将cfform 中的表单值传递给PDF。这是我的小测试页面,它遍历 50 条记录以提取名字和姓氏。我正在尝试将它们拉入pdf字段。目前,它将所有 50 个名字放入 firstname 字段,并将所有姓氏放入 pdf 的 lastname 字段。我没有与提交按钮结婚,但有什么更好的选择?
在我的最后一次迭代中,我将引入大约 100 个字段。
--形式--
<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>
--动作--
<cfpdfform action="populate" source="forms\#form.pdfselect#">
<cfpdfformparam name="FirstName" value="#form.FirstName#">
<cfpdfformparam name="LastName" value="#form.LastName#">
</cfpdfform>
【问题讨论】:
-
这里有什么问题?听起来你的问题很有效。
-
@Busches 它将所有名字拉入表单。这是页面和 pdf 的图像:imgur.com/KZ4HEiE,VIjlgDz
-
啊,那么下面马特的回答会解决你的问题。
标签: coldfusion submit cfform cfpdfform cfloop