flash形式绑定的coldfusion问题

时间:2011-02-02 20:36:52

标签: coldfusion cfform

我有以下内容:

 <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正确绑定?在最后一个例子中,我无法绑定到通用名称。讨厌这些闪光形式。

1 个答案:

答案 0 :(得分: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>