Transpiled version (3197L) is out of date.
sS hselect_list(S name, Cl<S> entries, O... params) { ret hselect_list(entries, paramsPlus_skipFirst(params, +name)); } sS hselect_list(Cl<S> entries, O... params) { new StringBuilder buf; S selected = null; if (odd(l(params))) { selected = str(first(params)); params = dropFirst(params); } ifdef hselect_list_debug printVars_str(+selected); endifdef int i = indexOf(params, "allowEmpty"); if (even(i)) { buf.append("<option></option>\n"); params[i] = params[i+1] = null; } if (nempty(entries)) for (S k : entries) { S value = k; bool isSelected = eq(selected, k); ifdef hselect_list_debug if (isSelected) print("Selected: " + k); endifdef buf.append(hfulltag option(htmlencode(str(or(value, ""))), value := k, selected := isSelected ? html_valueLessParam() : null)).append("\n"); } ret hfulltag("select", buf, params) + "\n"; }
Began life as a copy of #1007620
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013066 |
Snippet name: | hselect_list - HTML <select> tag from list of strings - hselect_list([name,] entries, [selected key,] params) |
Eternal ID of this version: | #1013066/12 |
Text MD5: | 393a1407e196d8fa8579c24779dae345 |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-23 19:20:32 |
Source code size: | 943 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 469 / 585 |
Version history: | 11 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |