Flash 表单绑定的冷融合问题:第 2 部分
我不知道为什么这个给我“未定义”。 imgNames 就在那里。
<cfquery name="getArt" datasource="cfartgallery">
select * from art where artid < 10
</cfquery>
<cfdump var="#getArt#">
<cfform name="myform" width="620" height="750" format="Flash" timeout="100" preservedata="yes" wmode="transparent">
<cfformitem type="script">
function updateSelectedArt():Void{
var elem;
var imgName;
var values = [];
var total = parseInt(myform.pickmany_total);
for (var i = 1; i <= total; i++) {
elem = _root["pickmany"+ i];
imgName = _root["img"+ i];
if (elem.selected) {
values.push(imgName.value);
}
}
// use whatever delmiter makes sense
_root["pickmany_selected"].text = values.join(",");
}
</cfformitem>
<cfoutput query="getArt">
<cfinput name="pickmany#currentRow#" type="checkbox" value="#artname#" onClick="updateSelectedArt()" label="#artname#"><br/>
<cfinput name="img#currentRow#" type="text" value="#largeImage#"><br/>
</cfoutput>
<cfinput type="hidden" name="pickmany_total" value="#getArt.recordCount#">
<cfinput type="text" name="pickmany_selected" value="" size="50">
</cfform>
I am not sure why this one gives me "undefined". the imgNames are there.
<cfquery name="getArt" datasource="cfartgallery">
select * from art where artid < 10
</cfquery>
<cfdump var="#getArt#">
<cfform name="myform" width="620" height="750" format="Flash" timeout="100" preservedata="yes" wmode="transparent">
<cfformitem type="script">
function updateSelectedArt():Void{
var elem;
var imgName;
var values = [];
var total = parseInt(myform.pickmany_total);
for (var i = 1; i <= total; i++) {
elem = _root["pickmany"+ i];
imgName = _root["img"+ i];
if (elem.selected) {
values.push(imgName.value);
}
}
// use whatever delmiter makes sense
_root["pickmany_selected"].text = values.join(",");
}
</cfformitem>
<cfoutput query="getArt">
<cfinput name="pickmany#currentRow#" type="checkbox" value="#artname#" onClick="updateSelectedArt()" label="#artname#"><br/>
<cfinput name="img#currentRow#" type="text" value="#largeImage#"><br/>
</cfoutput>
<cfinput type="hidden" name="pickmany_total" value="#getArt.recordCount#">
<cfinput type="text" name="pickmany_selected" value="" size="50">
</cfform>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
哎呀..
它应该是values.push(imgName.text);
这有效:
oopsie..
it is supposed to be values.push(imgName.text);
this works:
这是没有文本字段的:
this is without the text field: