Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michela 11 posts 31 karma points
    Jun 03, 2011 @ 16:50
    Michela
    0

    Zero experience with Umbraco - Need help with doc2form and contact form

    HI. So I have extremely basic HTML skills, the kind you get from messing around on MySpace, and I've worked with Umbraco a TINY bit, and by that I mean I've changed things on the Content pages, but never touched the settings or developer tabs. My boss knows I have no idea how to do this, but I came up with the idea praying another intern would take it on, but alas, I am saddled with the task. So basically I need a literal step by step explanation of how to use doc2form (installation? how do I install it? (Yes, this is how little I know)) to create a contact form for e-mail on my site's Contact Us page.
    I would like to create input boxes for Name, Company, Telephone, E-mail, and Comments (about what the person is interested in on the site).

    Here is what I need to understand...
    1. How do I "install" Doc2Form?
    2. Where do I put it in the umbraco site thing (and what's the "umbraco site thing" called? Like when I login to edit the site in a browser - just so I stop sounding so ignorant)? DocumentType? Template?
    3. Where do I put coding for the Contact Us form? In the "Contact Us" page content? How do I use the doc2form document type/template/whatever to make it work?
    4. (Especially ignorant question) If I find a site with a contact-us form I like, can I use their code by clicking "inspect element" (I use Chrome) and taking what appears? Or do I need to create my own code?

    Thank you SO much to anyone who tries to help me, I've literally been reading the forums and help pages for three days now, but I'm so, so unaware about coding and umbraco and everything to do with web design that NONE of it makes any kind of sense to me - which is why I really need help. Thank you, thank you, thank you. I'll be watching this thread closely so I can give any additional info anyone trying to help needs.

  • Michela 11 posts 31 karma points
    Jun 03, 2011 @ 16:53
    Michela
    0

    ALSO: We use Umbraco 2.1 ....outdated, I know

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 03, 2011 @ 18:30
    Lee Kelleher
    0

    Hi Michela,

    Firstly, just want to clarify that you are using Umbraco v2.1? Like you say, it is outdated - and with that, I doubt you'll find any packages that will work with it!

    ... I guess an upgrade to v4.7 is out of the question? ;-)

     

    Quick response to your questions...

    1. Forget about Doc2Form - it's going to be impossible to find a version that works with v2.1 ... and even if you do, no-one will want to support it! (Brutally honest, but with respect - forget about it!) ;-P

    2. Most of us call the "umbraco site thing" the Back Office.  I'll explain how to do the contact form shortly (below).

    3. Does your Contact Us page have it's own template? (in the Settings > Templates section)  (please say yes)

    4. Possibily, maybe!  You could take a copy of any HTML and CSS, then try to work it into your site - but that's gonna take as much time as doing it yourself from scratch - so it's up to you.

     

    OK, here's what I think you should do:

    1. Create a new user-control (.ascx) in the /usercontrols folder - called "ContactForm.ascx"

    Add this code...

    <%@ Control Language="C#" %>
    
    <script runat="server">
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string from = "[email protected]";
            string to = "[email protected]";
            string subject = "SemiNex: Contact Form";
            string messageText = "";
    
            messageText += "Name: " + this.txtName.Text + "\n";
            messageText += "Company: " + this.txtCompany.Text + "\n";
            messageText += "Telephone: " + this.txtTelephone.Text + "\n";
            messageText += "Email: " + this.txtEmail.Text + "\n";
            messageText += "Comments: " + this.txtComments.Text + "\n";
    
            System.Web.Mail.SmtpMail.Send(from, to, subject, messageText);
    
            this.pnlContactForm.Visible = false;
            this.pnlConfirmation.Visible = true;
        }
    </script>
    
    <asp:Panel runat="server" ID="pnlContactForm" Visible="true">
        <div>
            <asp:Label runat="server" ID="lblName" AssociatedControlID="txtName">Name:</asp:Label>
            <asp:TextBox runat="server" ID="txtName" />
        </div>
        <div>
            <asp:Label runat="server" ID="lblCompany" AssociatedControlID="txtCompany">Company:</asp:Label>
            <asp:TextBox runat="server" ID="txtCompany" />
        </div>
        <div>
            <asp:Label runat="server" ID="lblTelephone" AssociatedControlID="txtTelephone">Telephone:</asp:Label>
            <asp:TextBox runat="server" ID="txtTelephone" />
        </div>
        <div>
            <asp:Label runat="server" ID="lblEmail" AssociatedControlID="txtEmail">Email:</asp:Label>
            <asp:TextBox runat="server" ID="txtEmail" />
        </div>
        <div>
            <asp:Label runat="server" ID="lblComments" AssociatedControlID="txtComments">Comments:</asp:Label>
            <asp:TextBox runat="server" ID="txtComments" TextMode="MultiLine" Height="50" />
        </div>
        <asp:Button runat="server" ID="btnSubmit" CssClass="submit" Text="Submit" OnClick="btnSubmit_Click"/>
    </asp:Panel>
    
    <asp:Panel runat="server" ID="pnlConfirmation" Visible="false">
        <div>
            <p>Thank you for contacting SemiNex. We will be in touch very soon.</p>
        </div>
    </asp:Panel>

    Change any of the from/to/subject details at the top.

     

    2. In the Umbraco back-office, go to the Developer > Macros section.  Create a new Macro called "Contact Form".  Then associate the new .NET user-control "ContactForm.ascx" with the macro.

    3. Go to the the Settings > Templates section.  Find the template for the "Contact Us" page.  Put you cursor where you want to put the form and press the "Macro" button (can't remember if v2.1 has this, but think it does).  Pick the "Contact Form" macro (you created in step 2) ... it should look like some ugly HTML like "<?UMBRACO_MACRO".  If all is good, save the template.

    4. Test the page on the front-end ... job done! Enjoy the weekend!

     

    My big caveat with my code is that Umbraco v2.1 runs on ASP.NET 1.1 ... and I've been developing with newer version of .NET - so don't be suprised if it doesn't work first time - there may be some errors/issues!

    Good luck!

    Cheers, Lee.

  • Adam 51 posts 81 karma points
    Sep 29, 2011 @ 12:25
    Adam
    0

    Hi Lee,

    Will your code above work in Umbraco 4.7 and 4.7.1? I too am new to Umbraco but I have experience with HTML and CSS. I have no experience with .NET etc so XSLT and Macros is all very new to me.

    Thanks

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Sep 29, 2011 @ 12:28
    Lee Kelleher
    0

    Hi Adam,

    My code snippet is a regular .NET user-control - there's nothing version-specific tied to Umbraco, so yes, you can use it on 4.7.x. :-)

    Best of luck!

    Cheers, Lee.

  • Adam 51 posts 81 karma points
    Sep 29, 2011 @ 18:30
    Adam
    0

    Cheers, Lee. Will give it a go!

    Adam

Please Sign in or register to post replies

Write your reply to:

Draft