Skip to content

Commit

Permalink
Textarea fields in usermods
Browse files Browse the repository at this point in the history
A textarea with a label ending in `>` will be presented as a textarea,
allowing for multi-line text.
  • Loading branch information
obar committed Oct 22, 2024
1 parent 197f47b commit d8c7e99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions wled00/data/settings_um.htm
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,19 @@
}
break;
default:
t = "text"; c = `value="${o}" style="width:250px;"`;
if (f.substr(-1)===">") {
t = "textarea"; c = `style="width:300px;height:150px;"`;
} else {
t = "text"; c = `value="${o}" style="width:250px;"`;
}
break;
}
urows += ` ${initCap(f)} `; //only show field (key is shown in grouping)
// https://stackoverflow.com/questions/11657123/posting-both-checked-and-unchecked-checkboxes
if (t=="checkbox") urows += `<input type="hidden" name="${k}:${f}${a?"[]":""}" value="false">`;
else if (!a) urows += `<input type="hidden" name="${k}:${f}${a?"[]":""}" value="${t}">`;
urows += `<input type="${t==="int"?"number":t}" name="${k}:${f}${a?"[]":""}" ${c} oninput="check(this,'${k.substr(k.indexOf(":")+1)}')"><br>`;
if (t=="textarea") urows += `<br><textarea name="${k}:${f}${a?"[]":""}" ${c}>${o}</textarea><br>`;
else urows += `<input type="${t==="int"?"number":t}" name="${k}:${f}${a?"[]":""}" ${c} oninput="check(this,'${k.substr(k.indexOf(":")+1)}')"><br>`;
}
}
function pinDropdowns() {
Expand Down
2 changes: 1 addition & 1 deletion wled00/data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ button.sml {
.warn {
color: #fa0;
}
input {
input, textarea {
background: #333;
color: #fff;
font-family: Verdana, sans-serif;
Expand Down

0 comments on commit d8c7e99

Please sign in to comment.