Are you using Contact Form 0.9.4 with 1.4 successfully?

Topics: Troubleshooting
Mar 22, 2012 at 8:08 AM

Hey All, I’ve enabled the default Email module in orchard, though upon testing the contact form – I only ever receive an empty email? I've checked at the authors site without luck to a solution...

In the source:

        [HttpPost, ValidateInput(false)]
        public ActionResult Create(int id, string returnUrl)
        {
            //var model = Services.ContentManager.Create<ContactPart>("Contact");
            var model = new ContactPartRecord();
            var form = Services.ContentManager.Get(id);
            if (InvalidForm(form))
            {                
                _notifier.Error(T("Form submission was not from a valid source"));
                return this.RedirectLocal(returnUrl, "~/");
            }
            
            var contactForm = form.Parts.FirstOrDefault(p=> p is ContactFormPart);

            TryUpdateModel(model, new[]{"Company","CurrentWebsite","Email","Message","Name","Phone","Topic"});

            if (ModelState.IsValid)
            {
                //var contact = _contactService.MakeContact(model.Record);
                var contact = _contactService.MakeContact(model);
                _messenger.Send(contactForm.ContentItem.Record, MessageTypes.ContactRequest, "email", mapProperties(contact));
                _notifier.Information(T("Thanks for your inquiry, someone will respond to you shortly.")); // TODO: great place for a setting
            }
            else
            {
                notifyUserOfErrors(ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage));
                populateTempDataWithViewModelValues(model);
            }

            return this.RedirectLocal(returnUrl, "~/");
        }

contactForm.ContentItem.Record is always ‘Null’ within:

_messenger.Send(contactForm.ContentItem.Record, MessageTypes.ContactRequest, "email", mapProperties(contact));
I really don’t understand the whole recipient ‘contactForm.ContentItem.Record’ thing, but thought surely someone has come across this as well?  Any ideas on how to amend such code?

Thanks for your time, Dyr

Mar 22, 2012 at 10:28 AM

Actually, I’m getting a whole host of issues plaguing this module and not just the known ones that have some documented fixes, should I not bother with this module – does anyone use it successfully? There really isn’t anything else out there? Any thoughts, cheers dyr

Developer
Mar 23, 2012 at 12:23 AM

Perhaps try OForms?

Mar 23, 2012 at 4:52 AM

Thanks once again sfmskywalker, I completely dismissed Oforms believing it to be something else entirely *how wrong I was*. Anyhow, a much more refined module that just works out of the box. Thanks again, dyr

Mar 23, 2012 at 6:52 PM

I've just discovered that this module isn't working on 1.4 either. I tried all the others in the gallery, but they don't do what I want- create a contact us form widget.

Since what I need is a simple form for name, email address and message I'm thinking I might try to just build my own. Although it doesn't do what I want, I was going to take a que from the "Contact Us" module by Richard Garside and have the module designate a user to send the messages to. Once I get the thing working I'll commit it to CodePlex.

Coordinator
Mar 23, 2012 at 9:20 PM

You can also try the new forms feature that is going into 1.5. It's already available as source code and works on 1.4. http://orchardcustomforms.codeplex.com/