Sfoglia il codice sorgente

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

Brendan Abolivier 7 anni fa
parent
commit
a9d4285f91
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8
    2
      front/form.js

+ 8
- 2
front/form.js Vedi File

225
 	// The value must be an empty string so the browser can block the submit
225
 	// The value must be an empty string so the browser can block the submit
226
 	// event if the field is required
226
 	// event if the field is required
227
 	header.setAttribute('value', '');
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
 	field.appendChild(header);
235
 	field.appendChild(header);
230
 
236
 
231
 	// Add all options to select
237
 	// Add all options to select
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
 // higher level
275
 // higher level
270
 // fieldInfos: object describing the field
276
 // fieldInfos: object describing the field
271
 // required: boolean on whether the field is required or optional
277
 // required: boolean on whether the field is required or optional