Copied to clipboard

Flag this post as spam?

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


  • Mihir Ajmera 32 posts 145 karma points
    Aug 05, 2019 @ 05:36
    Mihir Ajmera
    0

    Make Custom Form, Model Validation and List Form in Back office, Custom Mail Configuration with MVC Razor in Umbraco 8.1.0

    Hello All,

    I am newer in UmbracoCMS and make one project using Umbraco 8.1.0 version which before months ago release by Umbraco Team.

    I need to implement one Contact us custom form in MVC with below features.

    1. Custom Razor View with mentions field Full Name, Email, Phone number, Message, etc.
    2. Custom Model bind with Custom Validation display on the front side.
    3. After submit form I need to save entry in the database and display list in the back office contact us (document type) in the content page.
    4. custom Mail configuration which I send mail to multiples mail id.

    For all thing, I getting one reference link https://our.umbraco.com/documentation/reference/routing/custom-controllers

    Using this I make one partial view Contact.cshtml and add document type = ContactUs (back office)which work as a controller in MVC form also one makes custom model and bind as mention below code. public ActionResult Contact(ContentModel model) {

            var contactUsModel = new ContactUsModel(model.Content);
            return View(contactUsModel);
        }
    

    ContaUsModel.cs which work as Model public class ContactUsModel : ContentModel { public ContactUsModel(IPublishedContent content) : base(content) { } public int Id { get; set; } [Required] [DisplayName("Full Name")] public string FullName { get; set; } [DisplayName("Email Address")] public string Email { get; set; } [DisplayName("Phone (Optional)")] public string Phone { get; set; } public string Message { get; set; } } Using this I call ContactUsController bind model and render in view. But after submit form without any entry I can`t fire the validation message for this because same method call again. So can you please help to how display validation message and also get dynamic document type node in code and bind save entry which can display at back end office also.

    After submitting form I need to configure the custom mail configuration which sends multiple emails with a template.

    Hope you understand my question and find the solution as soon as possible so I can easily implement in the project.

    Thanks in Advance.

Please Sign in or register to post replies

Write your reply to:

Draft