使用 ColdFusion 访问文本字段循环中的数据

发布于 2024-10-07 07:00:02 字数 184 浏览 0 评论 0原文

我对 ColdFusion 相当陌生,不太了解变量访问的工作原理。我创建了一个表,该表生成许多名为 condesc#i# 的文本字段,其中 i 是 cfloop 中的当前索引。

然后我有第二个循环,尝试访问已创建的每个字段的内容。我尝试使用 #condesc#i## 进行访问,但没有成功。

我应该如何从这些字段获取信息?

I am fairly new to ColdFusion, and don't quite understand how variable access works. I've created a table that generates a number of text fields named condesc#i#, where i is the current index in a cfloop.

I then have a second loop, that attempts to access the contents of each field that has been created. I have attempted to make access using #condesc#i##, but with no success.

How should I go about getting the information from these fields?

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

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

发布评论

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

评论(2

落叶缤纷 2024-10-14 07:00:02

所有变量都是结构,因此您可以像这样访问它们:

form[ "condesc" & i ]

并动态构建键。

All variables are structures so you can access them like this:

form[ "condesc" & i ]

And dynamically build the keys.

无所谓啦 2024-10-14 07:00:02

您可以使用括号表示法和字符串连接来引用动态变量名称:

<cfloop from="1" to="#count#" index="i">
    #form['condesc' & i]#  <br />
</cfloop>

You can reference dynamic variable names by using bracket notation and string concatenation:

<cfloop from="1" to="#count#" index="i">
    #form['condesc' & i]#  <br />
</cfloop>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文