Bladeren bron

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

Brendan Abolivier 7 jaren geleden
bovenliggende
commit
a9d4285f91
1 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
  1. 8
    2
      front/form.js

+ 8
- 2
front/form.js Bestand weergeven

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