フォームパラメータの使用

フォームパラメータを使用してデータをバインディングし画面に表示する流れです。

デザイナーでのフォームパラメータを設定

データ情報タブビューでOZFormParamを右クリックし、パラメータ設定を選択してパラメータを追加します。 その後、以下の図のようにmemberNoおよびfirstNameのTextBoxにパラメータ値を割り当てます(ドラッグ・アンド・ドロップ)。

Gender項目を設定するには、malefemaleのRadioButtonのOnBindイベントに以下のスクリプトを書き込みます。

// for "male"
if (This.GetDataSetValue("OZFormParam.gender") == "M") { 
	This.SetChecked(true);
}

// for "female"
if (This.GetDataSetValue("OZFormParam.gender") == "F") { 
	This.SetChecked(true);
}

bandAgreeバンドの表示を非アクティブにするには、bandAgreeOnBindイベントに以下のスクリプトを書き込みます。

if (This.GetDataSetValue("OZFormParam.bandAgree") == "false") {
	This.SetInvisible(true);
}

パラメーター値の送信

以下のようにHTMLでOZ Formパラメーターに値を渡します。

<script type="text/javascript" >
var serverUrl = "https://" + location.host;
function SetOZParamters_OZViewer(){
	var oz = document.getElementById("OZViewer");
	oz.sendToActionScript("information.debug", "true"); // viewer console
	oz.sendToActionScript("connection.servlet",serverUrl + "/oz/server");
	oz.sendToActionScript("connection.reportname","/eform/membership.ozr");
	oz.sendToActionScript("connection.pcount", "4");
	oz.sendToActionScript("connection.args1", "memberNo=" + "1001");
	oz.sendToActionScript("connection.args2", "firstName=" + "John Michael");
	oz.sendToActionScript("connection.args3", "gender=" + "M");
	oz.sendToActionScript("connection.args4", "bandAgree=" + "false");
	return true;
}
start_ozjs("OZViewer", serverUrl + "/oz/HTML5viewer/");
</script>

Run example

最終更新