diff --git a/src/addon/mod/data/fields/checkbox/component/checkbox.ts b/src/addon/mod/data/fields/checkbox/component/checkbox.ts
index 98cbe5cc7..2db02302a 100644
--- a/src/addon/mod/data/fields/checkbox/component/checkbox.ts
+++ b/src/addon/mod/data/fields/checkbox/component/checkbox.ts
@@ -40,7 +40,7 @@ export class AddonModDataFieldCheckboxComponent extends AddonModDataFieldPluginC
return;
}
- this.options = this.field.param1.split('\n').map((option) => {
+ this.options = this.field.param1.split(/\r?\n/).map((option) => {
return { key: option, value: option };
});
@@ -67,7 +67,7 @@ export class AddonModDataFieldCheckboxComponent extends AddonModDataFieldPluginC
* @param {any} value New value to be set.
*/
protected updateValue(value: any): void {
- this.value = value;
+ this.value = value || {};
this.value.content = value && value.content && value.content.split('##').join('
');
}
}
diff --git a/src/addon/mod/data/fields/multimenu/component/multimenu.ts b/src/addon/mod/data/fields/multimenu/component/multimenu.ts
index c642895f9..b31800229 100644
--- a/src/addon/mod/data/fields/multimenu/component/multimenu.ts
+++ b/src/addon/mod/data/fields/multimenu/component/multimenu.ts
@@ -40,7 +40,7 @@ export class AddonModDataFieldMultimenuComponent extends AddonModDataFieldPlugin
return;
}
- this.options = this.field.param1.split('\n').map((option) => {
+ this.options = this.field.param1.split(/\r?\n/).map((option) => {
return { key: option, value: option };
});
@@ -67,7 +67,7 @@ export class AddonModDataFieldMultimenuComponent extends AddonModDataFieldPlugin
* @param {any} value New value to be set.
*/
protected updateValue(value: any): void {
- this.value = value;
+ this.value = value || {};
this.value.content = value && value.content && value.content.split('##').join('
');
}
}