历史版本1 :自定义提交按钮 返回文档
编辑时间: 内容长度:图片数:目录数: 修改原因:

1. 问题描述编辑

在我们使用填报表时,有时只需要提交按钮将数据入库,不希望使用FR内置的工具栏的按钮,希望能够自定义提交按钮,自定义按钮既可以是FineReport模板中添加的按钮控件,也可以是web集成页面中,html的按钮标签,FineReport模板中的按钮控件实现自定义提交操作详细请参照自定义按钮实现提交操作,而在web页面中,点击html中的按钮提交iframe中的FineReport报表就在下面详述。
效果如下图:

2. 实现方法编辑

使用模板%FR_HOME%\WebReport\WEB-INF\reportlets\doc\Form\FreeFrom\FreeForm.cpt
在网页中添加按钮代码如下:
  1. <button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.writeReport()">提交</button>  
完整代码:

  1. <html>       
  2. <head>       
  3. <title>自定义浏览页面</title>       
  4. </head>       
  5. <body>       
  6. <div id="toolbar">       
  7. <button type="button" onclick="document.getElementById('reportFrame').contentWindow.contentPane.writeReport()">提交</button>  
  8. </div>       
  9. <iframe id="reportFrame" onload="afterload()" src="/WebReport/ReportServer?reportlet=doc\Form\FreeFrom\FreeForm.cpt&__showtoolbar__=false" width = 100% height = 80%></iframe>       
  10. </body>       
  11. </html>