动态网页表单

发布于 2024-08-16 03:07:40 字数 738 浏览 5 评论 0原文

我正在开发一个网络应用程序,允许在线编写和查看报告。这些报告将具有典型的学校报告或年度员工评估报告的结构。我希望用户能够自定义其报告的结构。例如,一所学校可能想要采用以下格式的报告

Subject   Comment       Score
-----------------------------
English   He sucks      20% 
Maths     He rocks      88%
Science   About average 70%

,而另一所学校可能想要

Subject   Grade
---------------
English     A
Maths       B
Science     C

我正在寻找的是一种让每所学校指定其报告格式的方法 - 可能是某种 JavaScript 表单构建库。这样的库可以在页面中使用,该页面允许用户构建一个表单,该表单将用作其报告的模板。

由于我需要处理在服务器端提交的每个报告,因此我需要捕获有关每个字段的一些语义。例如,如果用户可以指定报告中每个问题的答案是否应该是纯文本、数字分数、复选框、单选按钮等,那就太好了。

任何有关处理此类“动态”表单的有用技术的建议都会真的很感激。 XForms 看起来可能是相关的,但我还没有深入研究它。

干杯, 大学教师

I'm developing a web application that allows reports to be written and viewed online. These reports will have the structure of a typical school report or annual employee appraisal report. I would like the user to be able to customise the structure of their report. For example, one school might want a report in the format

Subject   Comment       Score
-----------------------------
English   He sucks      20% 
Maths     He rocks      88%
Science   About average 70%

whereas another might want

Subject   Grade
---------------
English     A
Maths       B
Science     C

What I'm looking for is a way for each school to specify the format of their reports - possibly some kind of JavaScript form-building library. Such a library could be used in a page that allows the uses to build a form which would be used as a template for their reports.

As I'll need to process each report submitted on the server-side, I'll need to capture some semantics about each field. For example, it would be great if the user could specify whether the answer to each question on the report should be plain text, a numerical score, a checkbox, radio buttons, etc

Any suggestions about useful technologies for handling such "dynamic" forms would be really appreciated. XForms looks like it might be relevant, but I haven't dug into it too deeply yet.

Cheers,
Don

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

高跟鞋的旋律 2024-08-23 03:07:40

一个非常漂亮的基于 XForms 的表单生成器,(LGPL) http://www.orbeon.com /

您可以在此处查看他们的表单生成器演示:http: //www.orbeon.com/ops/fr/orbeon/builder/summary/

A very nice XForms based form builder, (LGPL) http://www.orbeon.com/

You can check out their form builder demo here: http://www.orbeon.com/ops/fr/orbeon/builder/summary/

温柔女人霸气范 2024-08-23 03:07:40

我同意杰夫·贝克的评论,并且还注意到以下内容。

您说您的目标受众是非技术人员,并且上述所有解决方案都将涉及学习 HTML 和复杂的模板语言,这对您的受众来说可能是不可能的。

上述解决方案似乎也比您的问题所需的复杂性更高。 MooTools、Dojo 等看起来有点大材小用。 XForms 和 XSLT 更是如此。是的,它们会起作用并为您提供很多额外的功能,但是您是否需要与这些额外功能相关的复杂程度以及调试/可维护性/培训问题?

您的普通教师或业务用户可能对如何在 Excel 中输入和保存文件有基本的了解。如果您可以教他们如何以 CSV 格式保存并上传表单,或者更好的是安装一个将保存为 CSV 并将其发布到您的网站的宏,那么这可能是他们唯一需要的培训。要获得语义,您可以添加更多训练,并将报告的第一行作为列名称,第二行作为列类型。正如杰夫指出的那样,它并不优雅,但对于可能面临技术挑战的用户来说很容易采用。

在服务器端,我推荐以下堆栈:

Web server => node.js(也许使用Chain - github.com/hassox/chain)

数据存储=> Redis(和node-redis)

模板=> Haml-js (github.com/creationix/haml-js)

CSV 解析 =>请参阅http://purbayubudi.wordpress.com/2008/ 11/09/csv-parser-using-javascript/
并确保使用注释中的固定版本(用引号引起来)。

更精通技术的用户可以在不影响安全性的情况下自定义 HAML,而且 HAML 非常简单,只需进行一些培训即可:
这个 HAML...

 %body
.profile
  .left.column
    #date= print_date()
    #address= current_user.address
  .right.column
    #email= current_user.email
    #bio= current_user.bio

产生...

<div class="profile">
  <div class="left column">
     <div id="date">Thursday, October 8, 2009</div>
     <div id="address">Richardson, TX</div>
  </div>
  <div class="right column">
     <div id="email">[email protected]</div>
     <div id="bio">Experienced software professional...</div>
  </div>
</div>

I agree with Jeff Beck's comments and also noticed the following.

You said your target audience is non-technical and all of the solutions above are going to involve learning HTML and a complex template language, possibly a non-starter for your audience.

The solutions above also seem to need more complexity than your problem requires. MooTools, Dojo, etc. seem like overkill. XForms and XSLT even more so. Yes they'll work and give you a lot of extra functionality, but do you need the level of complexity and the issues of debugging/maintainability/training that go with those extra features?

Your regular teacher or business user probably has a basic understanding of how to enter and save files in Excel. If you can teach them how to save in CSV format and upload the form, or even better yet install a macro that will save to CSV and post it to your web site, then that's likely the only training they'll need. To get the semantics you can add a bit more training and have the first row of the report be the column names and the 2nd row be the column type. It's not elegant, but it is easy for possibly tech-challenged users to adopt, as Jeff points out.

On the server side I'd recommend the following stack:

Web server => node.js (perhaps using Chain - github.com/hassox/chain)

Data store => Redis (and node-redis)

Templating => Haml-js (github.com/creationix/haml-js)

CSV parsing => See http://purbayubudi.wordpress.com/2008/11/09/csv-parser-using-javascript/
and make sure to use the fixed version that's in the comments (for quoted commas).

Your more tech savvy users can customize the HAML without you compromising security, and HAML is pretty straightforward with a little training:
this HAML...

 %body
.profile
  .left.column
    #date= print_date()
    #address= current_user.address
  .right.column
    #email= current_user.email
    #bio= current_user.bio

produces...

<div class="profile">
  <div class="left column">
     <div id="date">Thursday, October 8, 2009</div>
     <div id="address">Richardson, TX</div>
  </div>
  <div class="right column">
     <div id="email">[email protected]</div>
     <div id="bio">Experienced software professional...</div>
  </div>
</div>
路弥 2024-08-23 03:07:40

务实的方法是使用 Google 电子表格的表单功能 ,来自 wufooJotForm

Pragmatic approach would be using google spreadsheet's feature called forms, (paid) services from wufoo or JotForm.

Saygoodbye 2024-08-23 03:07:40

我建议使用:

  • wiki 引擎或纯文本到 HTML 转换器(例如 Markdown),以允许用户自定义模板 您提供
  • HTML 模板库,以使用定义的模板插入数据

对于 HTML 转换器,您可以使用服务器端的 John Gruber 的 MarkDown(perl 语言),或 John Fraser 的 JavaScript 移植,Showdown

对于 HTML 模板,有许多可用的 Javascript 库,具体取决于您选择的框架:

I would suggest to use:

  • a wiki engine or a plain-text to HTML converter such as Markdown to allow your users to customize the templates you provide
  • an HTML templating library to insert the data using the defined template

For the HTML converter, you may use John Gruber's MarkDown (in perl) on the server-side, or a Javascript port by John Fraser, Showdown.

For the HTML templating, there are many Javascript libraries available, depending on your framework of choice:

凤舞天涯 2024-08-23 03:07:40

我负责 XSLTForms,它似乎是您想做的事情的一个很好的候选者。

XSLTForms 的可能性优于 XForms 1.1 规范:客户端的 XSLT、SVG 等。

动态表单可以使用 XForms 进行开发,如果它不足以满足您的应用程序的需要,XSLTForms 可以集成必要的扩展。

I'm in charge of XSLTForms, and it seems like a good candidate for what you want to do.

The possibilities for XSLTForms are superior to those of XForms 1.1 specification : XSLT at client-side, SVG, and others.

Dynamic forms can be developed with XForms and, in case it would not be enough for your application, XSLTForms could integrate necessary extensions.

何必那么矫情 2024-08-23 03:07:40

使用 Seaside 在 Smalltalk 中构建应该很容易。您有一个带有 WATableColumns 的 WATableReport。只需构建一个简单的编辑器,每个学校都可以在其中定义这些列。
我不确定 javascript 或 XForms 与它有什么关系。据我所知,除非您可以指定浏览器,否则 XForms 目前已失效。

Should be easy to build in Smalltalk with Seaside. You have a WATableReport with WATableColumns. Just build a simple editor where each school can define those columns.
I'm not sure what javascript or XForms have to do with it. As far as I know XForms is currently dead unless you can prescribe the browser.

你与昨日 2024-08-23 03:07:40

我认为如果表格变化不是太频繁,您不应该为非技术用户提供一个系统来搞乱报告,

而是让您的系统轻松添加新报告,在这种情况下,客户向您发送 pdf /excel 显示他们想要的格式,您可以快速拿出一份新报告,

这是我为我们的会计系统所做的,该系统用于多个诊所,我们还对每个报告更改收取象征性的费用(以防止用户无意识地更改)系统)

i think if the forms are not changing too frequently, you should not provide an system for the non-tech user to mess up with the reports

rather make ur system easy for YOU to add new reports, in this case, customer send you an pdf/excel showing the format they want, and you can quickly come up with a new report

that is was i did for our accounting system which being used for several clinics, we also charge a nominal fee for each report changing (to prevent user mindlessly changing the system)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文