+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Subscribe functionality in regular form

Subscribe functionality in regular form

2 posts, 0 answered
  1. Aaron
    Aaron avatar
    3 posts
    Registered:
    24 Oct 2012
    02 Sep 2014
    Link to this post
    My business user wants to create a poll for our customers using the normal Forms module, but they also want to have a checkbox on the form that allows the customer to sign up for a particular mailing list they already have setup in Sitefinity.   How can I create a form that acts like a normal form, but also has the subscribe functionality and how do I link that to the correct mailing list?
  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    05 Sep 2014
    Link to this post
    Hi Aaron,

    Sitefinity does not expose such functionality out of the box. You can attach to the IFormEntryCreated event in the Eventhub where you can check the value of the checkbox control

    public void FormsEventHandler(IFormEntryCreatedEvent eventInfo)
            {
                var entryId = eventInfo.EntryId;
                var formName = eventInfo.FormName;
     
                var manager = FormsManager.GetManager();
                FormEntry entry = null;
                var form = manager.GetFormByName(formName);
     
                if (form != null)
                {
                    string entryType = String.Format("{0}.{1}", manager.Provider.FormsNamespace, form.Name);
                    entry = manager.GetFormEntry(entryType, entryId);
                }
     
                if (entry != null)
                {
                    var fieldValue = entry.GetValue("FormControlProgrammaticName");
                }
            }

    If the user has checked it, leverage the subscribers API to add it to the maililng list. 

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered