如何解决这个问题,变形 HTML 表单

发布于 2024-10-10 11:00:31 字数 529 浏览 0 评论 0原文

您好,我不确定如何处理有关表单的逻辑。所以,表格很大,超过 20 个字段,我知道这被认为是“不好的做法”,表格应该最小化,但这就是客户想要的,所以没有争论,无论如何表格都会接受订单,但有不同的顺序类型(更具体地说 5)“普通类型”具有所有字段,其他类型具有一些字段,有些则没有,目前订单类型是从 get 参数中提取的,并基于其值某些显示字段而其他字段不显示,问题是当订单类型包含的字段少于“正常”类型时,如果有人砍掉一些部分而不是自然地适合,那么表单看起来会很难看,所以这里是我的一个小列表我想过(顺便说一句,我正在使用 JSP):

  • 为每个订单类型定义单独的样式,这意味着使用 JSTL 在标题中加载不同的 CSS 样式表。
  • 另一种方法是为每种类型的订单创建一个单独的 HTML 页面,每个页面将包含订单类型所需的字段,并拥有自己的 CSS 文件。
  • 对每种订单类型使用“c:choose”,并在每个“c:when”块中包含字段。我不太喜欢这个,因为这意味着在每个块中重复一些字段。

还有其他建议吗?

Hello I'm unsure of how to approach this Logic regarding a form. So, the form is big, more than 20 fields I know that is considered a "bad practice" and forms should be minimal, but thats how the client wants it so no arguing, anyways the form will take orders , but there are different order types (more specifically 5) the "normal type" has all fields and the other types have some fields and some not, at the moment the order type is extracted from a get paramater and based on its value some fields are displayed and other are not, the problem is that when the type of order contains less fields than the "normal" type the form looks ugly liked if someone chopped some parts instead of fitting naturally, so here's a small list of what I've thought (I'm using JSP by the way):

  • Define an individual style for each order type that means using the JSTL to load a different CSS stylesheet in the headers.
  • Another way would be to make a saparate HTML page for each type of order each page will contain the fields that the order type requires and will have their own CSS file.
  • Use a `c:choose` for each order type and include the fields in each `c:when` block. I don't like this very much because it means repeating some fields in each block.

Any other suggestions?

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

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

发布评论

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

评论(1

夏末的微笑 2024-10-17 11:00:31

您是否考虑过根据订单类型禁用/启用字段?
使用多页表单怎么样?

当你说 CSS 混乱时到底发生了什么?

如果我正确地阅读了你的问题,那么问题是纯粹的 CSS 问题 - 所以我将标签添加到问题中。你能发布你的 CSS 吗?具体来说,每个表单字段当前如何显示/隐藏。

您可能还想让您的客户知道(除非使用 ajax),如果用户错误地离开如此大的表单,他们可能(并且将会)丢失数据。

Have you considered disabling/enabling fields based on the order type?
How about using a multiple page form?

When you say the CSS is messed up what exactly happens?

If I read your question properly the problem is a purely CSS one - so I'm adding the tag to the question. Can you perhaps post your CSS? Specifically how each of your forms fields are currently shown/hidden.

You might also want to let your client know that (unless making use of ajax) that users may (and will) lose data if they navigate away from such a large form by mistake.

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