MOBiLE-2795 data: Fix saving entry with required URL field

main
Albert Gasset 2019-01-07 13:21:10 +01:00
parent e11cadbfe1
commit 9d1b74a455
1 changed files with 19 additions and 0 deletions

View File

@ -40,6 +40,25 @@ export class AddonModDataFieldUrlHandler extends AddonModDataFieldTextHandler {
return AddonModDataFieldUrlComponent;
}
/**
* Get field edit data in the input data.
*
* @param {any} field Defines the field to be rendered.
* @param {any} inputData Data entered in the edit form.
* @return {any} With name and value of the data to be sent.
*/
getFieldEditData(field: any, inputData: any, originalFieldData: any): any {
const fieldName = 'f_' + field.id;
return [
{
fieldid: field.id,
subfield: '0',
value: inputData[fieldName] || ''
}
];
}
/**
* Check and get field requeriments.
*