Esempio n. 1
0
        public static TextBox CreateTextBox(string id, string className, string value,
                                            string placeholder,
                                            bool spellcheck, bool disabled = false)
        {
            var textbox = new TextBoxWithNormalizedLineBreaks {
                EnableViewState = false
            };

            if (id != null)
            {
                textbox.ID = id;
            }
            if (disabled)
            {
                textbox.Attributes.Add("disabled", "disabled");
            }
            textbox.AddCssClasses(className);
            if (placeholder != null)
            {
                textbox.Attributes.Add("placeholder", placeholder);
            }
            textbox.Attributes.Add("spellcheck", spellcheck.ToString());
            if (value != null)
            {
                textbox.Text = value;
            }
            return(textbox);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var firstNameControl = new TextBoxWithNormalizedLineBreaks().AddCssClasses("email-form-first-name narrow no-zoom");

            EmailForm.AddOptionalItem(firstNameControl, true, "EmailFormFirstName", "First Name");

            var lastNameControl = new TextBoxWithNormalizedLineBreaks().AddCssClasses("email-form-last-name narrow no-zoom");

            EmailForm.AddOptionalItem(lastNameControl, true, "EmailFormLastName", "Last Name");

            var partyControl = new HtmlSelect();

            partyControl.AddCssClasses("email-form-party narrow no-zoom");
            //Parties.PopulateNationalParties(partyControl, true, null, true);
            // eliminate non-partisan
            Parties.PopulateNationalParties(partyControl, false, null, true);
            EmailForm.AddOptionalItem(partyControl, true, "EmailFormParty",
                                      "Your Preferred Political Party – the political party you would like to focus most of your efforts on",
                                      "Preferred Political Party");

            var stateControl = new HtmlSelect();

            stateControl.AddCssClasses("email-form-state narrow no-zoom");
            StateCache.Populate(stateControl, "--- Select state ---", Empty);
            EmailForm.AddOptionalItem(stateControl, true, "EmailFormState", "Your State", "State");

            var phoneControl = new TextBoxWithNormalizedLineBreaks().AddCssClasses("email-form-phone narrow no-zoom");

            EmailForm.AddOptionalItem(phoneControl, "EmailFormPhone",
                                      "Phone Number – only used if we can not reach you via email (optional)",
                                      "Phone");

            var passwordControl = new TextBoxWithNormalizedLineBreaks().AddCssClasses("email-form-password narrow no-zoom");

            EmailForm.AddOptionalItem(passwordControl, "EmailFormPassword",
                                      "Preferred Login Password – we will create and assign one for you if you have no preference (optional)",
                                      "Preferred Login Password");

            EmailForm.MessageOptional = true;
            EmailForm.Callback        = SubmitCallback;

            if (DomainData.IsValidStateCode) // Single state
            {
                Title           = $"{PublicMasterPage.SiteName} | {TitleTagSingleStateDomain.Substitute()}";
                MetaDescription = MetaDescriptionSingleStateDomain.Substitute();
            }
            else
            {
                Title           = $"{PublicMasterPage.SiteName} | {TitleTagAllStatesDomain.Substitute()}";
                MetaDescription = MetaDescriptionAllStatesDomain.Substitute();
            }

            EmailForm.ToEmailAddress = "*****@*****.**";
            EmailForm.CcEmailAddress = "*****@*****.**";

            EmailForm.SetItems(
                "I would like to volunteer for whatever is needed",
                "I would like to volunteer to scrape candidate websites",
                "I would like to volunteer to research county and local elected offices",
                "I would like to volunteer to interview and video candidates",
                "I would like to volunteer to speak to my local political parties/community outreach groups",
                "I would like to contact candidates via email");
        }