mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Add the 'required' HTML attr to one-option polls (radio buttons).
This commit is contained in:
parent
5a421847a7
commit
1b8d1abbfb
1 changed files with 14 additions and 4 deletions
18
html.c
18
html.c
|
@ -1804,12 +1804,22 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
|
|||
if (name) {
|
||||
char *ti = (char *)xs_number_str(xs_dict_get(replies, "totalItems"));
|
||||
|
||||
xs_html_add(form,
|
||||
xs_html_sctag("input",
|
||||
xs_html_attr("type", !xs_is_null(oo) ? "radio" : "checkbox"),
|
||||
xs_html *btn = xs_html_sctag("input",
|
||||
xs_html_attr("id", name),
|
||||
xs_html_attr("value", name),
|
||||
xs_html_attr("name", "question")),
|
||||
xs_html_attr("name", "question"));
|
||||
|
||||
if (!xs_is_null(oo)) {
|
||||
xs_html_add(btn,
|
||||
xs_html_attr("type", "radio"),
|
||||
xs_html_attr("required", "required"));
|
||||
}
|
||||
else
|
||||
xs_html_add(btn,
|
||||
xs_html_attr("type", "checkbox"));
|
||||
|
||||
xs_html_add(form,
|
||||
btn,
|
||||
xs_html_text(" "),
|
||||
xs_html_tag("span",
|
||||
xs_html_attr("title", ti),
|
||||
|
|
Loading…
Reference in a new issue