Copied to clipboard

Flag this post as spam?

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


  • Leszek 8 posts 28 karma points
    Nov 09, 2011 @ 04:15
    Leszek
    0

    Custom Contact Form

    Hi,

    I've developed my own contact form as an aspx page that I would like to use with Umbraco. What is the right approach to incorporate this page into my Umbraco website? I'd like to keep the same master page and styles as the rest of the website.

    Thanks,

    Leszek

     

  • Justin Spradlin 139 posts 347 karma points
    Nov 09, 2011 @ 06:21
    Justin Spradlin
    0

    Is there anyway that you could convert the aspx page to a custom control (ascx)? If so, you could create a custom control, upload it to the /usercontrols directory, then create a macro. The macro would point to the ASCX control. You could then add that new Contact Page macro to any template you like. You could then make a new template that includes this macro and assign this template to your Contact Page node in the content tree. 

  • Leszek 8 posts 28 karma points
    Nov 09, 2011 @ 17:02
    Leszek
    0

    Thanks Justin for your reply. Wow, it sounds like a bit of work especially when I do not have experience with Umbraco macros and templates. Let me put your guidelines into a step-by-step walkthrough:

    1. Convert the Contact.aspx page into a user control Contact.ascx (no problem with that).
    2. Upload the Contact.ascx user control to the /usercontrols folder.
    3. Create an Umbraco macro and point it to the user control.
    4a. Add the macro to any template.
    -or-
    4b. Create a new template, add the macro to it, and assign the template to the Contact Page node in the content tree.

    Could you confirm please if the above steps are correct?

    Thanks,

    Leszek
     

     

  • Justin Spradlin 139 posts 347 karma points
    Nov 09, 2011 @ 17:21
    Justin Spradlin
    0

    Yes you are correct. That will work.

    However I forgot that you can add it using other methods as well. Using a macro gives you the ability to insert the macro on a content page using the content editor for your node. If you choose the option for "Enable in Editor" on your macro, you can insert the macro using a picklist on the WYSIWYG html editor on the content editor tab for your page. If you create a Contact Us Node anywhere, you should see the "Insert Macro" on the content toolbar for the body text. If you enabled the macro to be available in the UI, then you will have a Contact Us macro in the drop down list for macros to insert. This method prevents you from having to create a specific template for the Contact page. So your users can enter contact forms on ANY page. 

    If you don't need that ability and don't fell like making a macro, then you can short circuit the process a little bit. You don't really have to have the macro for the custom control since it is just a regular old custom control. If you wanted you could also do this.

    1. Convert the Contact.aspx page into a user control Conatct.ascx
    2. Upload the Contact.ascs user control to the /userscontrols folder (and your compiled .dll to the bin folder)
    3. Update the template you will use for your Contact page and add the user control like any normal user control using the standard Register tags on the page like the following.
    <%@ Register Src="~/usercontrols/Contact.ascx" TagPrefix="custom" TagName="Contact" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="SomeParentContainer" runat="server">
       <custom:Contact runat="server"/>
    </asp:Content>

    I hope this helps, let me know if you need any more information.
    Justin
  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Nov 09, 2011 @ 17:26
    Jeroen Breuer
    0

    On this project page is a demo user contact form. You can also use it for having all the contact form info in 1 datatype.

    Jeroen

  • Leszek 8 posts 28 karma points
    Nov 10, 2011 @ 03:25
    Leszek
    0

    Thanks a lot!

    I've decided to create a macro and a template as it turned out it was not a big work - it works like a charm. A user control directly on the template worked well too.

    Thanks again,

    Leszek

  • Justin Spradlin 139 posts 347 karma points
    Nov 10, 2011 @ 03:35
    Justin Spradlin
    0

    Leszek, I am glad that it worked for you. It is so easy to find several ways to do the same task in umbraco. I love how everything is so flexible. 

    Jeroen, that package looks really cool, I will have to try that out on my next site. Thanks!

     

    Justin

Please Sign in or register to post replies

Write your reply to:

Draft