From ea5c8384befe6cb71297e2cb948b5d862630d093 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 15 May 2016 11:09:52 +0200 Subject: [PATCH] Wrong render of form checkbox (closes #1015). --- src/formelementcheck.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/formelementcheck.c b/src/formelementcheck.c index e44ef33..d3b62fc 100644 --- a/src/formelementcheck.c +++ b/src/formelementcheck.c @@ -20,6 +20,8 @@ #include #endif +#include + #include "commons.h" #include "tag.h" #include "formelementcheck.h" @@ -29,8 +31,6 @@ static void zak_cgi_form_element_check_init (ZakCgiFormElementCheck *zak_cgi_for static gchar *zak_cgi_form_element_check_render (ZakCgiFormElement *element); -static gboolean zak_cgi_form_element_check_is_valid (ZakCgiFormElement *element); - static void zak_cgi_form_element_check_set_property (GObject *object, guint property_id, const GValue *value, @@ -193,9 +193,10 @@ static gchar ht_attrs = klass->get_ht_attrs (element); value = zak_form_element_get_value (ZAK_FORM_ELEMENT (element)); - if (value != NULL) + if (value != NULL + && zak_utils_string_to_boolean (value)) { - g_hash_table_insert (ht_attrs, (gpointer)"value", (gpointer)g_strdup (value)); + g_hash_table_insert (ht_attrs, (gpointer)"checked", (gpointer)"checked"); } ret = zak_cgi_tag_tag_ht ("input", zak_cgi_form_element_get_id (element), ht_attrs); -- 2.49.0