Flash 表单绑定的冷融合问题:第 2 部分

发布于 2024-10-15 21:42:43 字数 1318 浏览 7 评论 0原文

我不知道为什么这个给我“未定义”。 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 技术交流群。

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

发布评论

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

评论(2

怪我太投入 2024-10-22 21:42:43

哎呀..

它应该是values.push(imgName.text);

这有效:

   <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.text);
          }
      }    
      // 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>

oopsie..

it is supposed to be values.push(imgName.text);

this works:

   <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.text);
          }
      }    
      // 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>
梦屿孤独相伴 2024-10-22 21:42:43

这是没有文本字段的:

  function updateSelectedArt():Void{
       var elem;
       var imgName;
       var values = [];
       var imgArray = [];
       <cfoutput query="getArt">
        imgArray[#getArt.currentRow#] = '#getArt.largeImage#';
       </cfoutput>
       var total  = <cfoutput>#getArt.recordCount#</cfoutput>;
       for (var i = 1; i <= total; i++) {
           elem = _root["pickmany"+ i];
           imgName = _root["img"+ i];
           if (elem.selected) {
                values.push(imgArray[i]);
            }
       }    
       _root["pickmany_selected"].text = values.join(",");
     } 

this is without the text field:

  function updateSelectedArt():Void{
       var elem;
       var imgName;
       var values = [];
       var imgArray = [];
       <cfoutput query="getArt">
        imgArray[#getArt.currentRow#] = '#getArt.largeImage#';
       </cfoutput>
       var total  = <cfoutput>#getArt.recordCount#</cfoutput>;
       for (var i = 1; i <= total; i++) {
           elem = _root["pickmany"+ i];
           imgName = _root["img"+ i];
           if (elem.selected) {
                values.push(imgArray[i]);
            }
       }    
       _root["pickmany_selected"].text = values.join(",");
     } 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文