summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/utils/html.c13
-rw-r--r--src/utils/html.h3
2 files changed, 10 insertions, 6 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index c71d159..7dc067f 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -799,20 +799,23 @@ mq_html_form_v(const gchar *submit_name, const gchar *submit_label,
}
gchar *
-mq_html_input_text(const gchar *name, const gchar *label, const gchar *value)
+mq_html_input_text(const gchar *name, const gchar *label, const gchar *value,
+ gboolean autofocus)
{
if (label && label[0]) {
return g_strdup_printf(
"<label for=\"%s\">\n<span>%s:</span>\n"
"<input type=\"text\" name=\"%s\" id=\"%s\" "
- "value=\"%s\">\n"
+ "value=\"%s\"%s>\n"
"</label>\n",
- name, label, name, name, value ? value : "");
+ name, label, name, name, value ? value : "",
+ autofocus ? " autofocus=\"autofocus\"" : "");
} else {
return g_strdup_printf(
"<input type=\"text\" name=\"%s\" id=\"%s\" "
- "value=\"%s\">\n",
- name, name, value ? value : "");
+ "value=\"%s\"%s>\n",
+ name, name, value ? value : "",
+ autofocus ? " autofocus=\"autofocus\"" : "");
}
}
diff --git a/src/utils/html.h b/src/utils/html.h
index 7e8002c..3f515df 100644
--- a/src/utils/html.h
+++ b/src/utils/html.h
@@ -77,7 +77,8 @@ mq_html_form_v(const gchar *submit_name, const gchar *submit_label,
const gchar *reset_name, const gchar *reset_label, gchar **children);
gchar *
-mq_html_input_text(const gchar *name, const gchar *label, const gchar *value);
+mq_html_input_text(const gchar *name, const gchar *label, const gchar *value,
+ gboolean autofocus);
gchar *
mq_html_input_number_i(const gchar *name, const gchar *label,