for (i = 0; i < messages->len; i++)
{
g_string_append_printf (str,
- "\n<span id=\"helpBox_%s_%d\" class=\"%s\">%s</span>",
- priv->id,
- i + 1,
- g_strcmp0 (priv->bootstrap_version, "4") == 0 ? "invalid-feedback" : "help-block",
- (gchar *)g_ptr_array_index (messages, i));
+ "\n%s",
+ zak_form_cgi_form_element_render_error_helpbox (element, i + 1, (const gchar *)g_ptr_array_index (messages, i)));
}
}
return ret;
}
+/**
+ * zak_form_cgi_form_element_render_error_helpbox:
+ * @element:
+ * @idx:
+ * @message:
+ *
+ */
+gchar
+*zak_form_cgi_form_element_render_error_helpbox (ZakFormCgiFormElement *element, guint idx, const gchar *message)
+{
+ gchar *ret;
+
+ ZakFormCgiFormElementPrivate *priv;
+
+ priv = zak_form_cgi_form_element_get_instance_private (element);
+
+ ret = g_strdup_printf ("<span id=\"helpBox_%s_%d\" class=\"%s\">%s</span>",
+ priv->id,
+ idx,
+ g_strcmp0 (priv->bootstrap_version, "4") == 0 ? "invalid-feedback" : "help-block",
+ message);
+
+ return ret;
+}
+
gchar
*zak_form_cgi_form_element_get_attr (ZakFormCgiFormElement *element, const gchar *attr)
{
gchar *zak_form_cgi_form_element_render (ZakFormCgiFormElement *element);
gchar *zak_form_cgi_form_element_render_label (ZakFormCgiFormElement *element);
+gchar *zak_form_cgi_form_element_render_error_helpbox (ZakFormCgiFormElement *element, guint idx, const gchar *message);
gchar *zak_form_cgi_form_element_get_attr (ZakFormCgiFormElement *element, const gchar *attr);
void zak_form_cgi_form_element_set_attr (ZakFormCgiFormElement *element, const gchar *attr, const gchar *value);