2016-03-21 14 views
4

我有這個基本過程的頁面:CFWINDOW - 表格在CF提交留在裏面CFWindow

  • 點擊旁的複選框你想下載的形式
  • 點擊提交
  • CFWindow彈出,收集一些基本信息
  • 點擊提交表格下載停留在這是由CFWindow

打開當你點擊子窗口,而在CFWindow中的mit按鈕,它會將你帶回到父頁面。我希望表單提交留在CFWindow中。我看到這個帖子:Refresh cfwindow content。但是,refreshOnShow = "true"不起作用。每次點擊提交時,都會返回到父窗口。

這裏是父頁面:

<cfform name="myform"> 
    <cfinput type="hidden" name="OrgID" value="#getit.orgID#"> 
    <table width="95%" border="0" cellspacing="5" cellpadding="0" align="center"> 
     <tr> 
     <td width="50%" valign="top" class="coretextforBR"> 
      <cfinput type="checkbox" name="GetThese" value="#form_ID#"> 
      <a class="corelinkforBR">#Forms_Name#</a> 
      <br /><br /> 
      #Forms_Description# 
      <br /><br /> 
     </td> 
     </tr> 
     <tr> 
     <td width="50%" valign="top" class="coretextforBR"> 
      <cfinput type="checkbox" name="GetThese" value="#form_ID#"> 
      <a class="corelinkforBR">#Forms_Name#</a> 
      <br /><br /> 
      #Forms_Description# 
      <br /><br /> 
     </td> 
     </tr> 
     <tr> 
     <td width="50%" valign="top" class="coretextforBR"> 
      <cfinput type="checkbox" name="GetThese" value="#form_ID#"> 
      <a class="corelinkforBR">#Forms_Name#</a> 
      <br /><br /> 
      #Forms_Description# 
      <br /><br /> 
     </td> 
     </tr> 
     <tr> 
     <td colspan="2"> 
      <input type="submit"value="Get It" onclick="javascript:ColdFusion.Window.show('mywindow1')"> 
     </td> 
     </tr> 
    </table> 
</cfform> 

    <cfwindow x="250" y="250" width="400" height="400" 
     name="mywindow1" title="Almost ready to download" initshow="false" draggable="false" resizable="false" 
     refreshOnShow="true" source="submitform.cfm?GetThese={myform:GetThese.value}&OrgID={myform:OrgID}&action=information" 
     bodystyle="background-color: white;" headerStyle="background-color: ###getcss.color#; font-family: #getcss.font#; color: ###getcss.fontcolor#;" /> 

這裏是源(submit.cfm)爲CFWwindow:

<cfparam name="attributes.action" default="information"> 
<cfoutput> 
    <html> 
    <head> 
     <style type="text/css"> 
     </style> 
    </head> 
    <body> 
     This window will collect information to begin download 
     <br> 
     <!--- action for downloading ---> 
     <cfif attributes.action eq "download"> 
     <cfloop info and stuff left out> 
      <a href="./log_download.cfm?filename=#Forms_File#&OrgID=#UrlEncodedFormat('#Forms_OrgID#')#" class="corelinkforBR">#Forms_Name#</a><br /> 
     </cfloop> 
     <!--- what you see when page initially loads ---> 
     <cfelse> 
      <form action="submitform.cfm?action=download" method="post"> 
       <input type="hidden" name="GetThese" value="#attributes.GetThese#"> 
       <input type="hidden" name="OrgID" value="#attributes.OrgID#"> 
       <table width="95%" border="0" align="center"> 
        <tr> 
        <td class="coretextforBR">First:</td> 
        <td><input type="text" name="CollectedInfo_First"></td> 
        </tr> 
        <tr> 
        <td class="coretextforBR">Last:</td> 
        <td><input type="text" name="CollectedInfo_Last"></td> 
        </tr> 
        <tr> 
        <td class="coretextforBR">Phone:</td> 
        <td><input type="text" name="CollectedInfo_Phone"></td> 
        </tr> 
        <tr> 
        <td class="coretextforBR">Email:</td> 
        <td><input type="text" name="CollectedInfo_Email"></td> 
        </tr> 
        <tr> 
        <td class="coretextforBR">Best way <br> to contact:</td> 
        <td><input type="text" name="CollectedInfo_BestWay"></td> 
        </tr> 
        <tr> 
        <td colspan="2"><input type="submit" value="Download" class="button one"></td> 
        </tr> 
       </table> 
      </form> 
     </cfif> 
</cfoutput> 
</body> 
</html> 

我不知道我做錯了。除了refreshOnShow之外,我找不到明確的答案。我應該重新考慮並做一個Ajax提交嗎?

+0

爲什麼不簡單地將其他表單域與複選框放在同一頁上? –

+0

他們不想讓他們在那裏。 :-( – Adam

+2

如果你在submit.cfm文件中給出了一個用cfwindow打開的窗口的'target',那麼怎麼辦?在你的例子中,我想'mywindow1'。*或者*在submit.cfm文件中定義'cfwindow'而不是與其他形式 –

回答

0

使用<cfform>代替正常<form>按照Liegh的建議工作。