Skip to content

Commit

Permalink
Fix the bug: #138
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Nov 30, 2016
1 parent 1c6da7f commit 31019b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/question_baseselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class QuestionSelectBase extends Question {
protected cachedValue: any;
otherItem: ItemValue = new ItemValue("other", surveyLocalization.getString("otherItemText"));
private choicesFromUrl: Array<ItemValue> = null;
private cachedValueForUrlRequestion: any = null;
private choicesValues: Array<ItemValue> = new Array<ItemValue>();
public choicesByUrl: ChoicesRestfull;
public otherErrorText: string = null;
Expand Down Expand Up @@ -49,6 +50,10 @@ export class QuestionSelectBase extends Question {
}
}
}
protected setNewValue(newValue: any) {
if (newValue) this.cachedValueForUrlRequestion = newValue;
super.setNewValue(newValue);
}
protected valueFromData(val: any): any {
if (this.getStoreOthersAsComment()) return super.valueFromData(val);
this.cachedValue = this.valueFromDataCore(val);
Expand Down Expand Up @@ -137,6 +142,9 @@ export class QuestionSelectBase extends Question {
}
this.choicesFromUrl = newChoices;
this.onVisibleChoicesChanged();
if (this.cachedValueForUrlRequestion) {
this.value = this.cachedValueForUrlRequestion;
}
}
private onVisibleChoicesChanged() {
this.visibleChoicesCache = null;
Expand Down

0 comments on commit 31019b9

Please sign in to comment.