From 4423637b03ef6f10a2f1392cabeb8e2fa9e11c39 Mon Sep 17 00:00:00 2001 From: Francis Fueconcillo Date: Sun, 14 May 2017 14:54:38 +0800 Subject: [PATCH] Add Element ID parameter for text-input-field so that its value can be retrieved at a later time --- library.json | 2 +- semantics.json | 8 ++++++++ text-input-field.js | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 918e926..141431f 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "A configurable editor element that can be used to describe an input field.", "majorVersion": 1, "minorVersion": 0, - "patchVersion": 5, + "patchVersion": 6, "runnable": 0, "author": "Joubel", "license": "MIT", diff --git a/semantics.json b/semantics.json index fd84fe4..ad489c0 100644 --- a/semantics.json +++ b/semantics.json @@ -58,5 +58,13 @@ "default": false, "optional": true, "description": "Check to make this field required, the user must answer all required fields to be able to export a document." + }, + { + "name": "elementId", + "label": "Element ID", + "type": "text", + "description": "Unique element ID that can be used to retrieve its value.", + "importance": "low", + "optional": true } ] diff --git a/text-input-field.js b/text-input-field.js index c4cc6a8..e5a60b7 100644 --- a/text-input-field.js +++ b/text-input-field.js @@ -76,7 +76,8 @@ H5P.TextInputField = (function ($) { // Remove trailing newlines return { description: this.params.taskDescription.replace(/^\s+|\s+$/g, '').replace(/(

|<\/p>)/img, ""), - value: this.$inputField.val() + value: this.$inputField.val(), + elementId: this.params.elementId }; };