0

我有以下内容:

 <cfquery name="getArt" datasource="cfartgallery">
   select * from art where artid < 10
 </cfquery>
 <cfform name="myform2" width="620" height="750"  timeout="100" preservedata="yes" wmode="transparent">
<cfoutput query="getArt">
<cfinput id="pickers#currentRow#" name="pickmany" type="checkbox" value="#artname#" >
<label for="pickers#currentRow#">#artname#</label> 
<br/>
</cfoutput>
<cfinput type="text" name="pickmany_selected"  bind="{pickmany}" size="50">
</cfform>

每当您选中一个框时,它都会添加到“pickmany_selected”字段中。

现在,我正在尝试使用 Flash 表单执行相同的行为。

 <cfform name="myform" width="620" height="750" format="Flash" timeout="100" preservedata="yes" wmode="transparent">    
<cfoutput query="getArt">
<cfinput id="pickers#currentRow#" name="pickmany" type="checkbox" value="#artname#" label="#artname#"><br/>
</cfoutput>

</cfform>   

这打破了。只有当我输入 name="pickmany#currentRow#" 时它才有效:

  <cfform name="myform" width="620" height="750" format="Flash" timeout="100" preservedata="yes" wmode="transparent">    
<cfoutput query="getArt">
<cfinput id="pickers#currentRow#" name="pickmany#currentRow#" type="checkbox" value="#artname#" label="#artname#"><br/>
</cfoutput>
<cfinput type="text" name="pickmany_selected"  bind="{pickmany1}" size="50">
  </cfform>

我需要为 flash 表单做什么才能正确绑定pickmany_selected?在最后一个示例中,我无法绑定到通用名称。讨厌这些闪光形式。

4

1 回答 1

1

只有当我输入 name="pickmany#currentRow#" 时它才有效:

是的,Flash 表单要求所有字段名称都是唯一的。因此,我怀疑绑定无法实现您的目标。但是,您可以滚动自己的函数并将其称为 onClick。我的闪光技能很生疏。但是沿着这些思路:

<cfform name="myform" width="620" height="750" format="Flash" timeout="100" preservedata="yes" wmode="transparent">    
    <cfformitem type="script">
        function updateSelectedArt():Void{
          var elem;
          var values = [];
          var total  = parseInt(myform.pickmany_total);
          for (var i = 1; i <= total; i++) {
            elem = _root["pickmany"+ i];
              if (elem.selected) {
                  values.push(elem.label);
              }
          }    
          // 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/>
    </cfoutput>
    <cfinput type="hidden" name="pickmany_total" value="#getArt.recordCount#">
    <cfinput type="text" name="pickmany_selected"  value="" size="50">
</cfform>
于 2011-02-03T03:01:52.037 回答