Skip to content
Snippets Groups Projects
Commit 047ce4c0 authored by François Grand's avatar François Grand
Browse files

fix: select default value not properly set

refs #592
parent 440a6b1c
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!199Resolve "Incohérence dans les fichiers de session"
...@@ -149,18 +149,20 @@ export abstract class SelectField extends Field { ...@@ -149,18 +149,20 @@ export abstract class SelectField extends Field {
if (val === undefined) { if (val === undefined) {
throw Error("invalid select default value " + value + " for " + this._associatedProperty + " property"); throw Error("invalid select default value " + value + " for " + this._associatedProperty + " property");
} }
} else if (this.nub !== undefined) { } else {
val = this.getEntryFromValue(this.nub.getPropValue(this._associatedProperty)); if (this.nub !== undefined) {
if (val === undefined) { val = this.getEntryFromValue(this.nub.getPropValue(this._associatedProperty));
throw Error("invalid select default value for " + this._associatedProperty + " property"); // nub may not have "this._associatedProperty" as a property
}
if (val === undefined && this._configDefaultValue !== undefined) {
val = this.getEntryFromValue(enumValueFromString(this._associatedProperty, this._configDefaultValue));
if (val === undefined) {
throw Error("invalid select default value " + this._configDefaultValue + " for " + this._associatedProperty + " property");
}
} }
} else if (this._configDefaultValue !== undefined) {
val = this.getEntryFromValue(enumValueFromString(this._associatedProperty, this._configDefaultValue));
if (val === undefined) { if (val === undefined) {
throw Error("invalid select default value " + this._configDefaultValue + " for " + this._associatedProperty + " property"); val = this._entries[0];
} }
} else {
val = this._entries[0];
} }
if (this._multiple) { if (this._multiple) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment