diff options
| author | supahgreg <supahgreg@users.noreply.github.com> | 2025-10-14 16:02:52 +0000 |
|---|---|---|
| committer | supahgreg <supahgreg@users.noreply.github.com> | 2025-10-14 16:02:52 +0000 |
| commit | dc8da3549294272f18f87a2446bf1180c1335d38 (patch) | |
| tree | 501bf7e89ef31acfb6d47fa257ef488b08292150 /js | |
| parent | 711999135ed3ad69be64eb14b9556b0d2fca2c74 (diff) | |
Fix default selection for 'App.select_tag()' and 'App.select_hash()'.
Diffstat (limited to 'js')
| -rw-r--r-- | js/App.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -71,16 +71,20 @@ const App = { ${this.attributes_to_string(attributes)} id="${App.escapeHtml(id)}">` }, select_tag: function(name, value, values = [], attributes = {}, id = "") { + value = String(value); + return ` <select name="${name}" dojoType="fox.form.Select" id="${App.escapeHtml(id)}" ${this.attributes_to_string(attributes)}> - ${values.map((v) => + ${values.map((v) => { + v = String(v); `<option ${v === value ? 'selected="selected"' : ''} value="${App.escapeHtml(v)}">${App.escapeHtml(v)}</option>` - ).join("")} + }).join("")} </select> ` }, select_hash: function(name, value, values = {}, attributes = {}, id = "", params = {}) { let keys = Object.keys(values); + value = String(value); if (params.numeric_sort) keys = keys.sort((a,b) => a - b); |