summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-07-11 09:48:50 +0200
committerGravatar default2024-07-11 09:48:50 +0200
commit1b8d1abbfb6f060f5bf98a1a3a46d662f3afbb36 (patch)
tree6b05de3cff378592ae5de651642f973b81b3bc89
parentDo nothing on polls without any vote. (diff)
downloadsnac2-1b8d1abbfb6f060f5bf98a1a3a46d662f3afbb36.tar.gz
snac2-1b8d1abbfb6f060f5bf98a1a3a46d662f3afbb36.tar.xz
snac2-1b8d1abbfb6f060f5bf98a1a3a46d662f3afbb36.zip
Add the 'required' HTML attr to one-option polls (radio buttons).
-rw-r--r--html.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/html.c b/html.c
index 0924d4f..a80c1d1 100644
--- a/html.c
+++ b/html.c
@@ -1804,12 +1804,22 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1804 if (name) { 1804 if (name) {
1805 char *ti = (char *)xs_number_str(xs_dict_get(replies, "totalItems")); 1805 char *ti = (char *)xs_number_str(xs_dict_get(replies, "totalItems"));
1806 1806
1807 xs_html_add(form, 1807 xs_html *btn = xs_html_sctag("input",
1808 xs_html_sctag("input",
1809 xs_html_attr("type", !xs_is_null(oo) ? "radio" : "checkbox"),
1810 xs_html_attr("id", name), 1808 xs_html_attr("id", name),
1811 xs_html_attr("value", name), 1809 xs_html_attr("value", name),
1812 xs_html_attr("name", "question")), 1810 xs_html_attr("name", "question"));
1811
1812 if (!xs_is_null(oo)) {
1813 xs_html_add(btn,
1814 xs_html_attr("type", "radio"),
1815 xs_html_attr("required", "required"));
1816 }
1817 else
1818 xs_html_add(btn,
1819 xs_html_attr("type", "checkbox"));
1820
1821 xs_html_add(form,
1822 btn,
1813 xs_html_text(" "), 1823 xs_html_text(" "),
1814 xs_html_tag("span", 1824 xs_html_tag("span",
1815 xs_html_attr("title", ti), 1825 xs_html_attr("title", ti),