ColdFusion での cfwindow オブジェクトの作成を制御するために JavaScript を使用しています。
cfwindow は、ユーザーが 1 つまたは複数のレコードを選択して、それらを 1 つのレコードに割り当てたり、割り当てを解除したりできるようにするフォームに添付されています。
cfwindow のほとんどのフォームでは、フォーム要素を入力してから送信する機能がユーザーに提供されます。その後、ウィンドウが破棄され、親ウィンドウが更新されて結果が表示されます。私の場合、ユーザーは完了する前に window オブジェクトで複数の送信を実行する場合があります。
流れは次のとおりです。
- ユーザーのオープン レコード。
- ユーザーは、cfwindow オブジェクトの作成にバインドされているボタンをクリックします。
- ユーザーは、レコードを親レコードに割り当てたり、割り当てを解除したりします。
- cfwindow オブジェクトは、割り当てが送信されるたびに更新されます。
- ユーザーは、閉じるボタンを使用してウィンドウ オブジェクトを閉じます (破棄します)。
- 親ウィンドウが更新されます。
今、私はすべてを持っていますが、#4は機能しています。ウィンドウは更新されます。ただし、変更 (割り当て済みまたは未割り当て) のレコードは表示されません。データ レイヤーが機能し、テーブルに変更が加えられていることを確認しました。ただし、ユーザーには表示されません。
そのため、フォームの onSuccess コントロールについて助けが必要です。ところで、私は cfform を使用しています。
これが私のコードサンプルです。addedit.cfm の下部を見ると、cfmodule のコードが表示されます。このページは cfassign.cfm と同じです。唯一の違いは、cfmodule では同じフォームを親と子の間で使用することを cfwindow では許可しないため、新しいフォームを作成したことです。
追加された.cfm
<!------------------------------------------------------------------
属性 -------------------------------------------------- ------------------>
• カテゴリー 。. . [リストから] を選択します。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . • 周波数 。. . [リストから] を選択します。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . • 状態 。. . [リストから] を選択します。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . • トレーニング方法。. . [リストから] を選択します。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 期間 コース費用 • 初期必須 はい いいえ • 起動が必要 はい いいえ コメント ( 200 文字制限 ) function cleanup() { // onHide の場合、cfwindow の内容を破棄します。 ColdFusion.Window.destroy('prerequisite',true); // 親ページをリロードして変更を表示する window.location.reload(); } function showWin(id) { //持っているか? {ColdFusion.Window.destroy('前提条件',true); を試してください。} catch(e) { } ColdFusion.Window.create('prerequisite','#qryCourses.Course_Title# の前提条件を割り当て','cfassign.cfm?id='+id,{height:400,width:1150,モーダル:false,refreshOnShow:true}); //ウィンドウ オブジェクトを取得するときに変数を割り当てる ob=ColdFusion.Window.getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> destroy('前提条件',true); } catch(e) { } ColdFusion.Window.create('prerequisite','#qryCourses.Course_Title# の前提条件を割り当て','cfassign.cfm?id='+id,{height:400,width:1150,モーダル:false,refreshOnShow:true}); //ウィンドウ オブジェクトを取得するときに変数を割り当てる ob=ColdFusion.Window.getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> destroy('前提条件',true); } catch(e) { } ColdFusion.Window.create('prerequisite','#qryCourses.Course_Title# の前提条件を割り当て','cfassign.cfm?id='+id,{height:400,width:1150,モーダル:false,refreshOnShow:true}); //ウィンドウ オブジェクトを取得するときに変数を割り当てる ob=ColdFusion.Window.getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> '#qryCourses.Course_Title# の前提条件を割り当てる','cfassign.cfm?id='+id,{height:400,width:1150,modal:false,refreshOnShow:true}); //ウィンドウ オブジェクトを取得するときに変数を割り当てる ob=ColdFusion.Window.getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> '#qryCourses.Course_Title# の前提条件を割り当てる','cfassign.cfm?id='+id,{height:400,width:1150,modal:false,refreshOnShow:true}); //ウィンドウ オブジェクトを取得するときに変数を割り当てる ob=ColdFusion.Window.getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---> getWindowObject('prerequisite_body'); //ウィンドウの中央を強制するコマンド ob.center(); //閉じたときにウィンドウをクリーンアップする ColdFusion.Window.onHide('prerequisite',cleanup); } cfassign.cfm ---><cfif StructKeyExists(form, "btnUnassignCourses") and StructKeyExists(form, "AssignedCourses") and len( form.AssignedCourses ) gt 0>
<!--- Remove courses as pre-requisites from the parent course. --->
<cfquery name="RemoveCoursePrerequisite" datasource="#Request.App.DSN#" >
</cfquery>
<cfelseif StructKeyExists(form, "btnAssignCourses") and StructKeyExists(form, "UnassignedCourses") and len( form.UnassignedCourses ) gt 0>
<!--- Add course as pre-requisites for the parent course. --->
<cfquery name="AddCoursePrerequisite" datasource="#Request.App.DSN#" >
</cfquery>
</cfif>
<table>
<tr>
<div class="ModuleFullName">
<td>
<div class="fieldWrapperControl">
<label>Assigned Courses (#qryAssignedCourses.Recordcount#)</label>
<cfselect
name="AssignedCourses"
style="font-size:.8125em; height:200px; width:500px;"
query="qryAssignedCourses"
display="Course_Description"
value="ID"
queryposition="below"
editable="no"
multiple="true">
</cfselect>
</div>
</td>
<div class="fieldWrapperButton">
<td style="vertical-align:middle;">
<cfinput type="submit" name="btnAssignCourses" value="<<" style="display:block;" />
<cfinput type="submit" name="btnUnassignCourses" value=">>" style="display:block;" />
</td>
</div>
<td>
<div class="fieldWrapperControl">
<label>Unassigned Courses (#qryUnassignedCourses.Recordcount#)</label>
<cfselect
name="UnassignedCourses"
style="font-size:.8125em; height:200px; width:500px;"
query="qryUnassignedCourses"
display="Course_Description"
value="Unassigned_ID"
queryposition="below"
editable="no"
multiple="true">
</cfselect>
</div>
</td>
</tr>
<tr>
<td colspan="3" style="font-size:.9em;"><label>** Press and hold down the Ctrl OR Shift key to select multiple courses.</label></td>
</tr>
</table>