]> saetta.ns0.it Git - libzakcgi/commitdiff
Added Form::render_start.
authorAndrea Zagli <azagli@libero.it>
Wed, 26 Aug 2015 15:40:23 +0000 (17:40 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 26 Aug 2015 15:40:23 +0000 (17:40 +0200)
src/form.c
src/form.h

index 0e154fdb038f4a6b37642f43887145b57f56b232..b86047597a5b913ab0c445fd91b7cf873a4bae9e 100644 (file)
@@ -136,6 +136,34 @@ zak_cgi_form_add_element (ZakCgiForm *zakcgiform, ZakCgiFormElement *element)
        return ret;
 }
 
+/**
+ * zak_cgi_form_render_start:
+ * @zakcgiform:
+ *
+ * Returns:
+ */
+gchar
+*zak_cgi_form_render_start (ZakCgiForm *zakcgiform)
+{
+       gchar *ret;
+
+       GString *str;
+
+       ZakCgiFormPrivate *priv;
+
+       priv = ZAK_CGI_FORM_GET_PRIVATE (zakcgiform);
+
+       str = g_string_new ("<form");
+
+       ret = zak_cgi_commons_ghashtable_to_str_attrs (priv->ht_attrs);
+       g_string_append_printf (str, "%s>", ret);
+       g_free (ret);
+
+       ret = g_strdup (str->str);
+
+       return ret;
+}
+
 /**
  * zak_cgi_form_render:
  * @zakcgiform:
@@ -157,10 +185,10 @@ gchar
 
        priv = ZAK_CGI_FORM_GET_PRIVATE (zakcgiform);
 
-       str = g_string_new ("<form");
+       str = g_string_new ("");
 
-       tmp = zak_cgi_commons_ghashtable_to_str_attrs (priv->ht_attrs);
-       g_string_append_printf (str, "%s>", tmp);
+       tmp = zak_cgi_form_render_start (zakcgiform);
+       g_string_append (str, tmp);
        g_free (tmp);
 
        g_hash_table_iter_init (&iter, priv->ht_elems);
index 107a1c027431a4dbb86017db9fc33307a57445a7..f14b14d4f840c19a4bf55c02f7faf05d0c4c6d8c 100644 (file)
@@ -56,6 +56,7 @@ ZakCgiForm *zak_cgi_form_new (ZakCgiMain *zakcgimain, ...);
 
 gboolean zak_cgi_form_add_element (ZakCgiForm *zakcgiform, ZakCgiFormElement *element);
 
+gchar *zak_cgi_form_render_start (ZakCgiForm *zakcgiform);
 gchar *zak_cgi_form_render (ZakCgiForm *zakcgiform);