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

Forums / General Discussions / Dynamic Types and the Forms API

Dynamic Types and the Forms API

10 posts, 0 answered
  1. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    13 Dec 2010
    Link to this post
    Hello All!

    I am trying to create a form backed by a dynamic type using code.  I have seen some examples of creating dynamic types here as well as on other posts.  But I don't see a clear answer as to how to perform CRUD operations on the dynamic types.

    I have successfully created the from and the type in my code but now I need to insert form data into it and have the data be displayed in the forms area of the Admin UI.  I want to use the Forms API and the existing Admin UI simply because I don't want to spend the time building a backend module myself.

    Here is my code:

    private void EnsureForm()
    {
        FormDescription fd;
        using (FormsManager mgr = FormsManager.GetManager())
        {
            mgr.Provider.SuppressSecurityChecks = true;
            if (mgr.GetForms()
                .Where(f => f.Id == ContactFormId)
                .FirstOrDefault() == null)
            {
                fd = mgr.CreateForm("ContactInfo", ContactFormId);
                fd.Name = "ContactInfo";
                fd.Status = ContentLifecycleStatus.Live;
                fd.SubmitAction = SubmitAction.TextMessage;
                fd.SubmitRestriction = SubmitRestriction.None;
                fd.SuccessMessage = "Thank you for contacting us.  We will get back with you soon.";
                fd.Description = "Flexible contact form";
                mgr.SaveChanges();
            }
        }
    }
     
    private void EnsureDynamicFields(FluentSitefinity fs, ref bool restart)
    {
        if (fs.DynamicData().Types().Where(t => t.Id == ContactTypeId)
            .Get().FirstOrDefault() == null)
        {
            bool changeDb = false;
            fs.DynamicData().Type().CreateNew("ContactInfo", "Telerik.Sitefinity.DynamicTypes.Model", ContactTypeId)
                .Field().TryCreateNew("FormName", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Prefix", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("FirstName", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("LastName", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Email", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Phone", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Address", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("City", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("State", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("ZipCode", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Country", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Title", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Experience", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("OrganizationName", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("OrganizationType", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("OtherType", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Materials", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("MoreInfo", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Notes", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("EducationLevel", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Expertise", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("OtherExpertise", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("Role", typeof(string), ref changeDb).Done()
                .Field().TryCreateNew("GeoArea", typeof(string), ref changeDb).Done()
                .SaveChanges(true);
                 
            if (changeDb)
                restart = changeDb;
        }
    }
     
    protected bool SaveDataInternal(IDictionary<string, object> values)
    {
         
        bool ret = true;
        using (FluentSitefinity sf = App.WorkWith())
        {
            bool restart = false;
            EnsureForm();
            EnsureDynamicFields(sf, ref restart);
            if (restart)
                SystemManager.RestartApplication(false);
            // persist data to ContactInfo dynamic type...please help!!!
     
        }
        return ret;
    }

    The reason I am not simply building forms using the Sitefinity UI is these forms have some more complex rules surrounding conditionally showing and hiding form elements based on user interaction.

    Thanks very much for your help.

    Bryan
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Dec 2010
    Link to this post
    Hi Bryan,

    You can see some examples that show how to perform these operations in this post.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    13 Dec 2010
    Link to this post
    Hey Ivan,

    Thanks for your super fast response!

    I saw that post.  It is working with a NewsItem.  I have used the same approach with extending an Image.  I think where I am having problems is it seems like I need to create a new instance of my dynamic type then populate it with data then save it.  So my approach has been:

    protected bool SaveDataInternal(IDictionary<string, object> values)
    {
         
        bool ret = true;
        using (FluentSitefinity sf = App.WorkWith())
        {
            bool restart = false;
            EnsureForm();
            EnsureDynamicFields(sf, ref restart);
            if (restart)
                SystemManager.RestartApplication(false);
            // persist data to ContactInfo dynamic type
            var typ = sf.DynamicData().Types().Where(t => t.Id == ContactTypeId);
            // try to add a new instance to my dynamic types
            
        }
        return ret;
    }

    But I don't see where I can add the data from my IDictionary.  Does this make sense?

    Thanks,
    Bryan
  4. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    15 Dec 2010
    Link to this post
    I think I have made some progress but now I am getting errors when attempting to create a new FormEntry.

    I have rewritten the code to extend the FormEntry object.  The MetaType and MetaFields are being created as well as the accompanying database table.  The problem that I am having now is when I attempt to insert data into the the new dynamic type, I get a DataException: Corrupted metadata integrity.  Also, I am creating a new FormDescription but it is not showing up in the Content->Forms Admin UI.  In fact, nothing does.  Not even a form previously created.

    I think I am getting close so if you could help nudge me to the right solution I would be very greatful.  Here is a copy of the exception and relevant code is pasted below.

    Corrupted metadata integrity.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.DataException: Corrupted metadata integrity.

    Source Error: 
    Line 302:                        foreach (KeyValuePair<string, object> pair in values)
    Line 303:                        {
    Line 304:                            if (e.DoesFieldExist(pair.Key))
    Line 305:                                e.SetValue(pair.Key, pair.Value.ToString());   
    Line 306:                        }
      Telerik.Sitefinity.Descriptors.LstringPropertyDescriptor.AddDescriptor(PropertyDescriptorCollection orgColl, List`1 list, String fieldName) +118
       Telerik.Sitefinity.Descriptors.LstringPropertyDescriptor.SetLocalStrings(PropertyDescriptorCollection allProperties) +147
       Telerik.Sitefinity.Descriptors.DynamicFieldsTypeDescriptor..ctor(ICustomTypeDescriptor parent, Type type) +373
       Telerik.Sitefinity.Model.DynamicFieldsTypeDescriptionProvider.GetTypeDescriptor(Type objectType, Object instance) +354
       System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties() +99
       System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes) +270
       Telerik.Sitefinity.Model.DataExtensions.DoesFieldExist(IDynamicFieldsContainer dataItem, String fieldName) +21
    private void EnsureForm()
    {
        using (FormsManager mgr = FormsManager.GetManager())
        {
            mgr.Provider.SuppressSecurityChecks = true;
            FormDescription fd = mgr.GetForms().Where(f => f.Id == ContactFormId)
                .FirstOrDefault();
            if (fd == null)
            {
                fd = mgr.CreateForm(CONTACT_TYPE_NAME, ContactFormId);
                fd.Name = CONTACT_TYPE_NAME;
                fd.Status = ContentLifecycleStatus.Live;
                fd.Title = "Flexible Contact Form";
                fd.Description = "Provides common data store for Exergy Dynamic Contact Forms";
                fd.SubmitAction = SubmitAction.TextMessage;
                fd.SuccessMessage = "Thank you for contacting us.  We will get back with you soon.";
     
                mgr.SaveChanges();
            }
        }
    }
     
    private void EnsureDynamicFields(FluentSitefinity fs, ref bool restart)
    {
        if (fs.DynamicData().Types().Where(t => t.Id == ContactTypeId)
            .Get().FirstOrDefault() != null)
            return;
        bool changeDb = false;
                     
        fs.DynamicData().Type().CreateNew(CONTACT_TYPE_NAME, CONTACT_TYPE_NAMESPACE, ContactTypeId)
            .Do(t => {
                t.DatabaseInheritance = DatabaseInheritanceType.vertical;
                t.BaseClassName = "Telerik.Sitefinity.Forms.Model.FormEntry";
            })
            .Field().TryCreateNew("FormName", typeof(string), ref changeDb).Do(mf => {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Subject", typeof(string), ref changeDb).Do(mf => {
                SetDefaultTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("Prefix", typeof(string), ref changeDb).Do(mf => {
                SetShortTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("FirstName", typeof(string), ref changeDb).Do(mf => {
                SetShortTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("LastName", typeof(string), ref changeDb).Do(mf => {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Email", typeof(string), ref changeDb).Do(mf => {
                SetShortTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("Phone", typeof(string), ref changeDb).Do(mf => {
                SetShortTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("Address", typeof(string), ref changeDb).Do(mf => {
                SetDefaultTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("City", typeof(string), ref changeDb).Do(mf => {
                SetDefaultTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("State", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("ZipCode", typeof(string), ref changeDb).Do(mf =>
            {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Country", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Title", typeof(string), ref changeDb).Do(mf =>
            {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Experience", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("OrganizationName", typeof(string), ref changeDb).Do(mf =>
            {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("OrganizationType", typeof(string), ref changeDb).Do(mf =>
            {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("OtherType", typeof(string), ref changeDb).Do(mf =>
            {
                SetShortTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Materials", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("MoreInfo", typeof(string), ref changeDb).Do(mf =>
            {
                SetLongTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Notes", typeof(string), ref changeDb).Do(mf =>
            {
                SetLongTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("EducationLevel", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("Expertise", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("OtherExpertise", typeof(string), ref changeDb).Do(mf => {
                SetDefaultTextField(ref mf); 
            }).Done()
            .Field().TryCreateNew("Role", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .Field().TryCreateNew("GeoArea", typeof(string), ref changeDb).Do(mf =>
            {
                SetDefaultTextField(ref mf);
            }).Done()
            .SaveChanges(true);
                 
        if (changeDb)
            restart = changeDb;
    }
     
    protected bool SaveDataInternal(IDictionary<string, object> values)
    {           
        bool ret = true;
        using (FluentSitefinity sf = App.WorkWith())
        {
            bool restart = false;
            EnsureForm();
            EnsureDynamicFields(sf, ref restart);
            if (restart)
                SystemManager.RestartApplication(false);
            sf.Forms().Form(ContactFormId).Entry()
                .CreateNew().Do(e =>
                {
                    foreach (KeyValuePair<string, object> pair in values)
                    {
                        if (e.DoesFieldExist(pair.Key))
                            e.SetValue(pair.Key, pair.Value.ToString());  
                    }
                }).SaveChanges();
        }
        return ret;
    }

    Thanks again,
    Bryan
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Dec 2010
    Link to this post
    Hello Bryan,

    1.You can use the built-in forms. When you create a form this is actually a new type. Each response is the item from your type.

    2. In your code you are calling SystemManager.RestartApplication(false); inside SaveDataInternal and in this case you need to get the managers again, because you are working in a different scope.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    18 Jan 2011
    Link to this post
    Thanks Ivan!  That helped.

    My data is not showing up in the Sitefinity Forms UI now.  I have successfully created my dynamic type by extending FormEntry using the following:
    private void EnsureDynamicFields()
    {
        MetadataManager manager = MetadataManager.GetManager();
        MetaType dynType = manager.GetMetaTypes()
            .Where(t => t.Id == ContactTypeId)
            .FirstOrDefault();
        if (dynType != null)
            return;
        LOG.InfoFormat("EnsureDynamicFields: Creating dynamic type ID: {0}", ContactTypeId);
        bool changeDb = false;
        using (FluentSitefinity fs = App.WorkWith())
        {
            fs.DynamicData().Type().CreateNew(CONTACT_TYPE_NAME, CONTACT_TYPE_NAMESPACE, ContactTypeId)
                .Do(t =>
                {
                    t.DatabaseInheritance = DatabaseInheritanceType.vertical;
                    t.BaseClassName = "Telerik.Sitefinity.Forms.Model.FormEntry";
                    t.IsDynamic = true;
                })
                .Field().TryCreateNew("FormName", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Form name");
                }).Done()
                .Field().TryCreateNew("Subject", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Subject");
                }).Done()
                .Field().TryCreateNew("Prefix", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Prefix");
                }).Done()
                .Field().TryCreateNew("FirstName", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "First name");
                }).Done()
                .Field().TryCreateNew("LastName", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Last name");
                }).Done()
                .Field().TryCreateNew("Email", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "E-mail");
                }).Done()
                .Field().TryCreateNew("Phone", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Phone");
                }).Done()
                .Field().TryCreateNew("Address", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Address");
                }).Done()
                .Field().TryCreateNew("City", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "City");
                }).Done()
                .Field().TryCreateNew("State", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "State or region");
                }).Done()
                .Field().TryCreateNew("ZipCode", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Zip or postal code");
                }).Done()
                .Field().TryCreateNew("Country", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Country");
                }).Done()
                .Field().TryCreateNew("JobTitle", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Title");
                }).Done()
                .Field().TryCreateNew("Experience", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Experience");
                }).Done()
                .Field().TryCreateNew("OrganizationName", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Organization name");
                }).Done()
                .Field().TryCreateNew("OrganizationType", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Organization type");
                }).Done()
                .Field().TryCreateNew("OtherType", typeof(string), ref changeDb).Do(mf =>
                {
                    SetShortTextField(ref mf, "Other type");
                }).Done()
                .Field().TryCreateNew("Materials", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Materials");
                }).Done()
                .Field().TryCreateNew("MoreInfo", typeof(string), ref changeDb).Do(mf =>
                {
                    SetLongTextField(ref mf, "Additional info");
                }).Done()
                .Field().TryCreateNew("Notes", typeof(string), ref changeDb).Do(mf =>
                {
                    SetLongTextField(ref mf, "Notes");
                }).Done()
                .Field().TryCreateNew("EducationLevel", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Education Level");
                }).Done()
                .Field().TryCreateNew("Expertise", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Area of expertise");
                }).Done()
                .Field().TryCreateNew("OtherExpertise", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Other expertise");
                }).Done()
                .Field().TryCreateNew("Role", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Role or position");
                }).Done()
                .Field().TryCreateNew("GeoArea", typeof(string), ref changeDb).Do(mf =>
                {
                    SetDefaultTextField(ref mf, "Geographical location");
                }).Done()
                .SaveChanges(true);
            LOG.InfoFormat("EnsureDynamicFields: dynamic type created with ID: {0}", ContactTypeId);
        }
        if (changeDb)
            SystemManager.RestartApplication(false);
    }

    I have successfully created a new FormDescription using the following:
    private void EnsureForm()
    {
        using (FormsManager mgr = FormsManager.GetManager())
        {
            mgr.Provider.SuppressSecurityChecks = true;
            FormDescription fd = mgr.GetForms().Where(f => f.Id == ContactFormId)
                .FirstOrDefault();
            if (fd == null)
            {
                LOG.InfoFormat("EnsureForm: FormDescription ID: {0} was not found.  Creating it.", ContactFormId);
                fd = mgr.CreateForm(CONTACT_TYPE_NAME, ContactFormId);
                fd.Name = CONTACT_TYPE_NAME;
                fd.Status = ContentLifecycleStatus.Live;
                fd.Title = "Flexible Contact Form";
                fd.Description = "Provides common data store for Exergy Dynamic Contact Forms";
                fd.SubmitAction = SubmitAction.TextMessage;
                fd.SuccessMessage = "Thank you for contacting us.  We will get back with you soon.";
                fd.DateCreated = DateTime.UtcNow;
                mgr.SaveChanges();
                LOG.InfoFormat("EnsureForm: Created FormDescription \"{0}\" with ID: {1}", fd.Title, ContactFormId);
            }
        }
    }

    I am successfully entering data into the database using the following:
    protected bool SaveDataInternal(IDictionary<string, object> values)
    {           
        bool ret = true;
        EnsureDynamicFields();
        EnsureForm();
        try
        {
            App.WorkWith().Forms().Form(ContactFormId).Entry()
                .CreateNew().Do(e =>
                {
                    object output = String.Empty;
                    if (values.TryGetValue("IpAddress", out output))
                        e.IpAddress = output.ToString();
                    foreach (KeyValuePair<string, object> pair in values)
                    {
                        if (e.DoesFieldExist(pair.Key))
                            e.SetValue(pair.Key, pair.Value.ToString());
                    }
                }).SaveChanges();
            LOG.Info("SaveDataInternal: new ContactInfo created");
        }
        catch (Exception ex)
        {
            ret = false;
            LOG.Error("SaveDataInternal: failed to create ContactInfo", ex);
        }
        return ret;
    }

    The newly created form shows up under /Sitefinity/Content/Forms and it shows that there are responses but when I attempt to go to /Sitefinity/Content/Forms/Entries/ContactInfo Sitefinity shows an empty UI.  When I dig further, The service /Sitefinity/Forms/FormsService.svc is returning Error 101 (net::ERR_CONNECTION_RESET): Unknown error.

    I feel like I am getting very close.  Any ideas?

    Thanks,
    Bryan
  7. Dido
    Dido avatar
    149 posts
    Registered:
    24 Sep 2012
    25 Jan 2011
    Link to this post
    Hello Bryan,

    This is not how you work with the forms module.
    1) Forms are much like pages in Sitefinity. They consist of controls (instead of PageControl-s, they have FormControl-s). In fact, they share a lot of functionality
    2) The first thing you do is create a FormDescription
    4) Create a form (manager.CreateForm), edit it (manager.EditForm), add controls (manager.CreateControl<FormDraftControl>) to the draft, and finally publish the draft.
    5) The forms manager automatically builds the dynamic type from the form description (manager.BuildDynamicType)

    I followd your example to the letter and the service never returned any error. It runs as expected. Your form has no controls, and that is why you can't create entries on the frondend. Once you actually create the controls via the UI, the form entries are properly displayed.

    Anyway, I really see no point in going through all this hassle. Why not create your forms via the UI, create a backend page and drop a forms controls on it?

    All the best,
    Dido
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Bryan
    Bryan avatar
    62 posts
    Registered:
    20 Jul 2010
    25 Jan 2011
    Link to this post
    The primary reason for this is we need to show and hide controls based on user inputs.  For example, if a user selects yes or no on a radio button we need to show/hide other controls.  I don't see where the canned forms support conditional processing based on user input.  It would be cool if there were some sort of hook that would allow us, as developers, to hook into events other than the submit button.

    I will dig around and see if this functionality is possible.  Otherwise, I will start working on plugging in a module to display these form submissions.

    Thanks,
    Bryan
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Feb 2011
    Link to this post
    Hi Bryan,

    Out of the box we do not have this implementation. If we are talking for public controls and form widget you can create a custom control that inherits from FieldControl and implements IFormFieldControl . In the template of the FieldControl you can add the controls that you want to show/hide. Depending on a property you have set you can show/hide the controls from a page by using two or more div elements and setting style= display:none or using Visible=false. If you want to use two separate controls dropped on  a different places of your page it will be harder, because you have to know the position of the control which will allow you to use jQuery methods to hide /show this control.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. dhawal
    dhawal avatar
    4 posts
    Registered:
    03 Jun 2016
    12 Jul
    Link to this post

    Hi Ivan ,

    Can you tell me whether it is possible to access the sitefinity forms in the code file. I have a scanerio wherein the forms will be created in the Sitefinity CMS but will be displayed dynamically as per accessed data. 

     

    Bottomline : I need to access the forms which i can add in my custom widget for the users to enter data and dynamically set the forms name as and when required.

10 posts, 0 answered