Flash 表单绑定的冷融合问题

发布于 2024-10-15 18:05:11 字数 1583 浏览 3 评论 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 ?在最后一个示例中,我无法绑定到通用名称。讨厌这些flash形式。

i have the following :

 <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>

whenever you check a box, it adds to the "pickmany_selected" field.

now, i am trying to do the same behaviour with a flash form.

 <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>   

this breaks. it only works if i put 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>

what do i need to do for the flash form so that pickmany_selected binds correctly? in the last example, i cannot bind to a generic name. hate these flash forms.

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

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

发布评论

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

评论(1

惜醉颜 2024-10-22 18:05:11

只有当我输入时它才有效
名称=“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>

it only works if i put
name="pickmany#currentRow#":

Yes, flash forms require all field names to be unique. Because of that, I suspect your goal is not possible with a bind. However, you could roll your own function and call it onClick. My flash skills are pretty rusty. But something along these lines:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文