gpt4 book ai didi

ColdFusion 10 getting element is undefined in form 错误

转载 作者:行者123 更新时间:2023-12-03 09:55:00 26 4
gpt4 key购买 nike

我有一个 ColdFusion 10 表单,我要向其中添加一个新的多选列表

<SELECT multiple="multiple" id="icd9list" 
name="icd9list"
size="2"
class="pageText2"
style="width:400px;">
</SELECT>

它正确地显示在表单上,​​我可以使用 JavaScript 将项目添加到它,但是当我去处理表单时,表单操作页面出现以下错误:

Element ICD9LIST is undefined in FORM.

我在初始表单页面以及出现错误的表单操作页面上添加了 cfparam 标记。

我一辈子都弄不明白为什么它不将表单元素传递到操作页面。方法是post,所以应该是捡起来的。页面上的所有其他表单元素都可以正常拾取。

<cfform action="updform.cfm" name="custform" method="POST">

我也尝试使用 custform.icd9list 并遇到了同样的问题:

Element ICD9LIST is undefined in CUSTFORM.

这个页面是一些非常遗留的代码,我们真的不能回去重构太多。我唯一想的是,当页面首次加载时,多选选项是空白的,然后我们在事后通过弹出窗口中的 javascript 添加选项。当我检查 Chrome 中的元素时,在我向其添加选项后,它们就在那里,但我想知道它是否仍被视为空白的多选列表。我确实知道,如果我删除 multiple 属性并将表单元素视为单个下拉列表,它会在表单转储中显示一个值,但只有第一个(或任何选定的)值。

开始认为答案可能是有一个填充了选项值的隐藏字段,并让表单读取它。

最佳答案

向多选列表添加选项是不够的。他们也必须被选中。否则,该列表不被视为 successful control并且该字段不会传递到操作页面(强调我的)

A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.

However:

  • Controls that are disabled cannot be successful.
  • If a form contains more than one submit button, only the activated submit button is successful.
  • All "on" checkboxes may be successful.
  • For radio buttons that share the same value of the name attribute, only the "on" radio button may be successful.
  • For menus, the control name is provided by a SELECT element and values are provided by OPTION elements. Only selected options may be successful. When no options are selected, the control is not successful and neither the name nor any values are submitted to the server when the form is submitted.
  • The current value of a file select is a list of one or more file names. Upon submission of the form, the contents of each file are submitted with the rest of the form data. The file contents are packaged according to the form's content type.
  • The current value of an object control is determined by the object's implementation.

我怀疑表单在提交表单之前没有强制“选择”项目,这就是操作页面上没有显示任何内容的原因。

关于ColdFusion 10 getting element is undefined in form 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52044526/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com