# Survey 插件的 min/max 尚未实现也未验证

**URL:** https://meta.discourse.org/t/survey-plugin-min-max-not-implemented-nor-validated/404023
**Category:** Bug
**Tags:** surveys
**Created:** [2026年五月28日 16:17 UTC](https://meta.discourse.org/t/survey-plugin-min-max-not-implemented-nor-validated/404023 "2026-05-28T16:17:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2026年五月28日 16:17 UTC](https://meta.discourse.org/t/survey-plugin-min-max-not-implemented-nor-validated/404023/1 "2026-05-28T16:17:22Z")

</div>

> [@Discourse](#):
>
> ### 字段属性
> 
> 所有字段类型都支持以下属性：
> 
> - `question`：问题文本（必填）
> - `required`：字段是否必须填写（`true`/`false`，默认为 `true`）
> - `min`：数值字段的最小值
> - `max`：数值字段的最大值

除了语言上先说“所有字段类型”，然后又说 `min` 和 `max` 仅“适用于数值字段”之外：

这些功能似乎并未实现，范围始终固定为 1 到 10？

此外，由于没有验证机制，用户可以篡改这些值，甚至提交 999 这样的数值。

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [2026年六月8日 17:10 UTC](https://meta.discourse.org/t/survey-plugin-min-max-not-implemented-nor-validated/404023/2 "2026-06-08T17:10:53Z")

</div>

确实！感谢反馈，我已经提交了一个拉取请求（PR），将使最小值/最大值功能正常工作并验证提交内容：

> <https://github.com/discourse/discourse-surveys/pull/99>
>
> Reported here: https://meta.discourse.org/t/survey-plugin-min-max-not-implemente…d-nor-validated/404023
> 
> The \`min\` and \`max\` values were documented, but never used. Number fields always rendered a 1 - 10 scale, and because submitted values weren't checked server-side, a custom request could store any value.
> 
> This wires up the min & max values, includes a migration to add the new min/max columns, and adds new specs to validate. 
> 
> Existing surveys are unaffected.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2026年六月10日 22:00 UTC](https://meta.discourse.org/t/survey-plugin-min-max-not-implemented-nor-validated/404023/3 "2026-06-10T22:00:20Z")

</div>

本主题已在 19 小时后自动关闭，不再允许新回复。
