/*
- * Copyright (C) 2015-2016 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2015-2017 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
static void zak_form_cgi_form_element_init (ZakFormCgiFormElement *zak_form_cgi_form_element);
static void zak_form_cgi_form_element_construct (ZakFormCgiFormElement *element,
- const gchar *id,
- GHashTable *ht_attrs);
+ const gchar *id,
+ GHashTable *ht_attrs);
static GHashTable *zak_form_cgi_form_element_get_ht_attrs (ZakFormCgiFormElement *element);
static void zak_form_cgi_form_element_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void zak_form_cgi_form_element_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static void zak_form_cgi_form_element_dispose (GObject *gobject);
static void zak_form_cgi_form_element_finalize (GObject *gobject);
g_hash_table_replace (priv->ht_attrs, g_strdup ("class"), g_strdup ("form-control"));
}
+ if (!zak_form_element_get_editable (ZAK_FORM_ELEMENT (element)))
+ {
+ g_hash_table_insert (priv->ht_attrs, (gpointer)"readonly", (gpointer)"readonly");
+ }
+
g_string_append (str, ZAK_FORM_CGI_FORM_ELEMENT_GET_CLASS (element)->render (element));
}
for (i = 0; i < messages->len; i++)
{
g_string_append_printf (str,
- "\n<span id=\"helpBox_%s%d\" class=\"help-block\">%s</span>",
- priv->id,
- i + 1,
- (gchar *)g_ptr_array_index (messages, i));
+ "\n<span id=\"helpBox_%s%d\" class=\"help-block\">%s</span>",
+ priv->id,
+ i + 1,
+ (gchar *)g_ptr_array_index (messages, i));
}
}
/* PRIVATE */
static void
zak_form_cgi_form_element_construct (ZakFormCgiFormElement *element,
- const gchar *id,
- GHashTable *ht_attrs)
+ const gchar *id,
+ GHashTable *ht_attrs)
{
ZakFormCgiFormElementPrivate *priv;
static void
zak_form_cgi_form_element_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
ZakFormCgiFormElement *zak_form_cgi_form_element = (ZakFormCgiFormElement *)object;
ZakFormCgiFormElementPrivate *priv = ZAK_FORM_CGI_FORM_ELEMENT_GET_PRIVATE (zak_form_cgi_form_element);
static void
zak_form_cgi_form_element_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
ZakFormCgiFormElement *zak_form_cgi_form_element = (ZakFormCgiFormElement *)object;
ZakFormCgiFormElementPrivate *priv = ZAK_FORM_CGI_FORM_ELEMENT_GET_PRIVATE (zak_form_cgi_form_element);