From: Andrea Zagli Date: Sun, 15 May 2016 09:09:52 +0000 (+0200) Subject: Wrong render of form checkbox (closes #1015). X-Git-Tag: v0.1.0~3^2~5 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=ea5c8384befe6cb71297e2cb948b5d862630d093;p=libzakcgi Wrong render of form checkbox (closes #1015). --- 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);