如何在 Catalyst 中使用 HTML::FormHandler 创建嵌套表单?

发布于 2024-09-06 13:34:02 字数 247 浏览 2 评论 0原文

我遇到的情况是,我们有一个包含大约十万条记录的基本记录集。而且,我们正在创建一个单独的应用程序,该应用程序共享部分数据集,但不是大部分数据集,因此我们正在创建一个与原始表具有一对一关系的详细表。我想要做的是从原始表中提取现有信息并将其显示为只读,但我希望详细表中的字段是可写的。

我首先创建一个包含原始表内容的列表,我希望用户能够通过条目顺利地点击“编辑”,然后进入表单以创建详细记录,单击“保存”并拥有它更新或创建记录。

那么,最好的方法是什么?

I have a situation where we have a base recordset with about one hundred thousand records. And, we are creating a separate application that shares some of the dataset, but not most, so we are creating a detail table that has a one to one relationship with the original table. What I want to do is pull the existing information from the original table and display it as read only, but I want the fields in the detail table to be writeable.

I've started by creating a listing with the contents of the original table, I want the user to be able to seemlessly hit "edit" by an entry and be taken to the form to create the detail record, click save, and have it update, or create the record.

So, what is the best way to do this?

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

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

发布评论

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

评论(2

我不咬妳我踢妳 2024-09-13 13:34:02

这个问题很老了,但为了帮助未来的搜索者...

如果您的 DBIx::Class 结果源设置正确,则会自动处理在表单中包含相关表。只需使用其他字段的关系名称定义复合字段并使用相关表中的列名称定义子字段,即可将相关表拉入表单。

请参阅:HTML::FormHandler::Manual::Fields< /a>

和: HTML::FormHandler::Manual::Database

This question is old, but in order to help future searchers...

Including a related table in a form is handled automatically if your DBIx::Class result sources are correctly setup. A related table can be pulled into the form by simply defining a compound field using the relationship name of the other field and defining subfields with the names of the columns in the related table.

See: HTML::FormHandler::Manual::Fields

And: HTML::FormHandler::Manual::Database

放手` 2024-09-13 13:34:02

这不是一个真正的答案,因为我无法真正为您提供解决方案,但我希望可以为您提供一个起点。我认为您需要在 HTML::FormHandler 中定义一个表单,它代表详细信息表中的一行,然后从单行表单的多个实例构建只读表单。本文描述的问题和部分解决方案比我更好:

http://catdev.blogspot.com/2009/05/defining-form-processing-problem.html

我对 Perl 和 HTML::FormHandler 相当陌生,而且很有可能有一个更好的方法来做到这一点。我之前已经在 PHP 中“手动”解决了这个问题,但我确信在 Perl 中也会遇到这个问题。

This isn't a real answer, in that I can't really provide you with a solution, but I can hopefully provide you with somewhere to start. I think you need to define a form in HTML::FormHandler which represents a single row from your detail table, then build your read-only form from multiple instances of single-row form. This article describes the problem and a partial solution much better than I have:

http://catdev.blogspot.com/2009/05/defining-form-processing-problem.html

I'm fairly new to Perl and HTML::FormHandler, and there's a good chance that there is a better way of doing this. It's a problem that I have solved 'manually' in PHP before, but one which I am sure I will come across in Perl.

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