Esempio n. 1
0
        public string render_tag_error(XmlElement e, string t_val, Hashtable t_att, string g_att, Hashtable h)
        {
            QWebForm f = h["form"] as QWebForm;

            if (f.GetError(t_val))
            {
                return(render_element(e, g_att, h));
            }
            else
            {
                return("");
            }
        }
Esempio n. 2
0
        public string render_tag_type(XmlElement e, string t_val, Hashtable t_att, string g_att, Hashtable h)
        {
            QWebForm f    = h["form"] as QWebForm;
            string   r    = "";
            string   name = t_att["name"] as string;
            string   css  = f.GetError(name) ? "form_error" : "form_valid";

            if (t_val == "text" || t_val == "password")
            {
                string val = HttpUtility.HtmlEncode(f.GetDisplay(name));
                g_att += String.Format(" type=\"{0}\" name=\"{1}\" value=\"{2}\" class=\"{3}\"", t_val, name, val, css);
                r      = render_element(e, g_att, h);
            }
            else if (t_val == "textarea")
            {
                string val = HttpUtility.HtmlEncode(f.GetDisplay(name));
                g_att += String.Format(" name=\"{0}\" class=\"{1}\"", name, css);
                r      = String.Format("<{0}{1}>{2}</{3}>", t_val, g_att, val, t_val);
            }
            else if (t_val == "checkbox" || t_val == "radio")
            {
                string val = e.GetAttribute("t-value");
                if (val == null)
                {
                    val = "";
                }
                string check = "";
                if (f.CSVCheckboxes)
                {
                    string[] comp = f.GetDisplay(name).Split(',');
                    if (Array.IndexOf(comp, val) != -1)
                    {
                        check = " checked=\"checked\"";
                    }
                }
                else
                {
                    if (val == f.GetDisplay(name))
                    {
                        check = " checked=\"checked\"";
                    }
                }
                g_att += String.Format(" type=\"{0}\" name=\"{1}\" value=\"{2}\" class=\"{3}\"{4}", t_val, name, val, css, check);
                r      = render_element(e, g_att, h);
            }
            return(r);
        }
Esempio n. 3
0
        public string render_tag_invalid(XmlElement e, string t_val, Hashtable t_att, string g_att, Hashtable h)
        {
            if (h["form"] == null)
            {
                QU.rwe("QWeb: No form was found in the Hashtable");
            }
            QWebForm f = h["form"] as QWebForm;

            if (f.AnyError())
            {
                return(render_element(e, g_att, h));
            }
            else
            {
                return("");
            }
        }
Esempio n. 4
0
        public string render_tag_select(XmlElement e, string t_val, Hashtable t_att, string g_att, Hashtable h)
        {
            QWebForm f   = h["form"] as QWebForm;
            string   r   = "";
            string   val = e.GetAttribute("t-value");

            if (val == null)
            {
                val = "";
            }
            string selected = "";

            if (val == f.GetDisplay(t_val))
            {
                selected = " selected=\"selected\"";
            }
            g_att += String.Format(" value=\"{0}\"{1}", val, selected);
            r      = render_element(e, g_att, h);
            return(r);
        }