Quellcode durchsuchen

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

Brendan Abolivier vor 7 Jahren
Ursprung
Commit
a9d4285f91
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8
    2
      front/form.js

+ 8
- 2
front/form.js Datei anzeigen

@@ -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