Skip to content

Commit

Permalink
Dropdown initial empty value #170 #171 #175
Browse files Browse the repository at this point in the history
  • Loading branch information
schefbi committed Aug 16, 2024
1 parent 2820269 commit 925fbd9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/components/input/input-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default Component.extend({
change(){
let field = this.get('field');
let currentValue = null;

document.getElementById(this.elementId).children[0].classList.remove('required');

document.getElementsByName(field.id).forEach(input => {
if(field.options.showAsRadioButtons) {
Expand Down
18 changes: 10 additions & 8 deletions app/templates/components/input/input-dropdown.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
{{/each}}
</div>
{{else}}
<select id="vss{{this.field.id}}" class="uk-select" name={{this.field.id}} autocomplete={{this.field.options.autocomplete}}
{{#if this.field.options.required}}
<select id="vss{{this.field.id}}" class="uk-select required" name={{this.field.id}} autocomplete={{this.field.options.autocomplete}}
disabled={{this.field.options.disabled}} required="">
<option disabled selected value>{{translate "formOptionEmpty"}}</option>
{{this.dropdownOptions}}
</select>
{{else}}
<select id="vss{{this.field.id}}" class="uk-select" name={{this.field.id}} autocomplete={{this.field.options.autocomplete}}
disabled={{this.field.options.disabled}}>
{{#unless this.field.options.required}}
<option value=""></option>
{{/unless}}
<option value>{{translate "formOptionEmpty"}}</option>
{{this.dropdownOptions}}
<!--
{{#each this.field.options.options as |option|}}
<option value={{option.Key}}>{{option.Value}}</option>
{{/each}}-->
</select>
{{/if}}
{{/if}}
1 change: 1 addition & 0 deletions public/locale/de-CH.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ window.kursausschreibung.locale["de-CH"] = {
"formAddressLine1Placeholder": "Musterstrasse 99",
"formZipPlaceholder": "3000",
"formLocationPlaceholder": "Bern",
"formOptionEmpty": "-- Leer --",
"duplicateEmailError": "Die E-Mail-Adresse muss unterschiedlich sein, ansonsten kann das Formular nicht übermittelt werden.",
"addPerson": "Weitere Person anmelden",
"removePerson": "Letzte Person entfernen",
Expand Down
1 change: 1 addition & 0 deletions public/locale/fr-CH.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ window.kursausschreibung.locale["fr-CH"] = {
"formAddressLine1Placeholder": "Musterstrasse 99",
"formZipPlaceholder": "3000",
"formLocationPlaceholder": "Bern",
"formOptionEmpty": "-- Vide --",
"duplicateEmailError": "L'adresse e-mail doit être différente, sinon le formulaire ne peut pas être soumis.",
"addPerson": "Inscrire une autre personne",
"removePerson": "Enlever la dernière personne",
Expand Down

0 comments on commit 925fbd9

Please sign in to comment.