作成日: 2018/04/11 最終更新日: 2018/07/25
文書種別
不具合
状況
修正済み
詳細
フォームのSubmit時にDisplayMemberPathの項目がモデルに格納されます。本現象はSelectedValuePathを明示的に設定している場合にも発生します。
回避方法
この問題は2018J v2(4.0.20182.160)で修正されました。
※修正版を適用しない場合の回避方法は以下の通りです。
selectedIndexChanged/textChangedイベントの処理により値を更新するスクリプトをコントロールを配置したビューに実装する方法が考えられます。
<script>
var oldBeforeInitFunc = c1.mvc.input._AutoCompleteInitializer.prototype._beforeInitializeControl;
c1.mvc.input._AutoCompleteInitializer.prototype._beforeInitializeControl = function (options) {
if (options.isEditable != undefined && options.isEditable === false) {
if (options.text != undefined) {
options.selectedValue = options.text;
delete options.text;
}
} else {
if (options.text != undefined) {
options.selectedValue = options.text;
delete options.text;
}
}
oldBeforeInitFunc.call(this, options);
}
var oldAfterInitFunc = c1.mvc.input._AutoCompleteInitializer.prototype._afterInitializeControl;
c1.mvc.input._AutoCompleteInitializer.prototype._afterInitializeControl = function (options) {
oldAfterInitFunc.call(this, options);
var dropDownControl = this.control;
if (dropDownControl.isEditable) {
if (options.selectedValue != undefined) {
if (dropDownControl.selectedIndex == -1) {
dropDownControl.text = options.selectedValue;
}
}
}
}
c1.mvc.input._AutoCompleteInitializer.prototype._updateHiddenField = function () {
var input = this._hiddenElement;
var dropDownControl = this.control;
if (dropDownControl.isEditable) {
if (dropDownControl.selectedValue) {
input.value = dropDownControl.selectedValue;
} else {
input.value = dropDownControl.text;
}
dropDownControl.textChanged.addHandler(function(){
if (dropDownControl.selectedValue) {
if (dropDownControl.text != dropDownControl.getDisplayText()) {
//入力時
input.value = dropDownControl.text;
} else {
input.value = dropDownControl.selectedValue;
}
} else {
input.value = dropDownControl.text;
}
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
dropDownControl.selectedIndexChanged.addHandler(function () {
if (dropDownControl.selectedValue) {
input.value = dropDownControl.selectedValue;
} else {
input.value = dropDownControl.text;
}
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
} else {
input.value = dropDownControl.selectedValue;
dropDownControl.selectedIndexChanged.addHandler(function() {
input.value = dropDownControl.selectedValue;
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
}
}
</script>
※修正版を適用しない場合の回避方法は以下の通りです。
selectedIndexChanged/textChangedイベントの処理により値を更新するスクリプトをコントロールを配置したビューに実装する方法が考えられます。
<script>
var oldBeforeInitFunc = c1.mvc.input._AutoCompleteInitializer.prototype._beforeInitializeControl;
c1.mvc.input._AutoCompleteInitializer.prototype._beforeInitializeControl = function (options) {
if (options.isEditable != undefined && options.isEditable === false) {
if (options.text != undefined) {
options.selectedValue = options.text;
delete options.text;
}
} else {
if (options.text != undefined) {
options.selectedValue = options.text;
delete options.text;
}
}
oldBeforeInitFunc.call(this, options);
}
var oldAfterInitFunc = c1.mvc.input._AutoCompleteInitializer.prototype._afterInitializeControl;
c1.mvc.input._AutoCompleteInitializer.prototype._afterInitializeControl = function (options) {
oldAfterInitFunc.call(this, options);
var dropDownControl = this.control;
if (dropDownControl.isEditable) {
if (options.selectedValue != undefined) {
if (dropDownControl.selectedIndex == -1) {
dropDownControl.text = options.selectedValue;
}
}
}
}
c1.mvc.input._AutoCompleteInitializer.prototype._updateHiddenField = function () {
var input = this._hiddenElement;
var dropDownControl = this.control;
if (dropDownControl.isEditable) {
if (dropDownControl.selectedValue) {
input.value = dropDownControl.selectedValue;
} else {
input.value = dropDownControl.text;
}
dropDownControl.textChanged.addHandler(function(){
if (dropDownControl.selectedValue) {
if (dropDownControl.text != dropDownControl.getDisplayText()) {
//入力時
input.value = dropDownControl.text;
} else {
input.value = dropDownControl.selectedValue;
}
} else {
input.value = dropDownControl.text;
}
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
dropDownControl.selectedIndexChanged.addHandler(function () {
if (dropDownControl.selectedValue) {
input.value = dropDownControl.selectedValue;
} else {
input.value = dropDownControl.text;
}
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
} else {
input.value = dropDownControl.selectedValue;
dropDownControl.selectedIndexChanged.addHandler(function() {
input.value = dropDownControl.selectedValue;
c1.mvc.Utils.triggerValidationChangeEvent(input);
});
}
}
</script>
旧文書番号
82611