瀏覽代碼

Changed the display of a select-typed custom field's label if labels are disabled

Brendan Abolivier 7 年之前
父節點
當前提交
a9d4285f91
共有 1 個檔案被更改,包括 8 行新增2 行删除
  1. 8
    2
      front/form.js

+ 8
- 2
front/form.js 查看文件

@@ -225,7 +225,13 @@ function getSelectField(fieldInfos) {
225 225
 	// The value must be an empty string so the browser can block the submit
226 226
 	// event if the field is required
227 227
 	header.setAttribute('value', '');
228
-	header.innerHTML = lang.form_select_header_option;
228
+	// If the labels are disabled, set the header option's inner text as the
229
+	// field's label
230
+    if(labels) {
231
+		header.innerHTML = lang.form_select_header_option;
232
+	} else {
233
+		header.innerHTML = fieldInfos.label;
234
+	}
229 235
 	field.appendChild(header);
230 236
 
231 237
 	// Add all options to select
@@ -265,7 +271,7 @@ function getTextarea(fieldInfos, required) {
265 271
 }
266 272
 
267 273
 
268
-// Returns a base HTML element with generic info to be processed by functions at 
274
+// Returns a base HTML element with generic info to be processed by functions at
269 275
 // higher level
270 276
 // fieldInfos: object describing the field
271 277
 // required: boolean on whether the field is required or optional