Entries from Forms

Posted by Community Admin on 04-Aug-2018 22:13

Entries from Forms

All Replies

Posted by Community Admin on 23-May-2011 00:00

I am wanting to create a custom control that displays collective results of the entries from a specific form built in the Forms Module.  Do you have an example of how to retrieve this data?  I have found the FormManager and FormsManager, but I do not see a method that gets entries for a specific form.

Thanks!
Alex Lorenz
Indianapolis Motor Speedway | INDYCAR

Posted by Community Admin on 24-May-2011 00:00

Hi Alex,

To get the response of a form you can use

public IEnumerable GetFormEntries(Type entryType, string filter, string orderBy, int skip, int take, ref int? count)

            var formsManager = FormsManager.GetManager();
            stringentryTypeName = String.Format("0.1", "
Telerik.Sitefinity.DynamicTypes.Model", "yourformname");
            var itemType = formsManager.GetEntryType(entryTypeName);
  
            int? totalCount = 0;
            IEnumerable items = null;
            try
            
                items = formsManager.GetFormEntries(itemType, string.Empty, string.Empty, 0, 0, reftotalCount);
            


Regards,
Ivan Dimitrov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Jun-2011 00:00

This gets the entries, but is there then a method to get the values from that entry?

Thanks!
Alex Lorenz

Posted by Community Admin on 08-Jun-2011 00:00

Hi Alex,

GetFormEntries returns list of the FormEntry which you can use to get the values.

Regards,
Ivan Dimitrov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 15-Jun-2011 00:00

I am able to get values of the entry, such as SubmittedOn, UserID, IpAddress, but is there another method to get the actual response.  For example, we have a form out there that has a single multiple choice form widget and I want all the values from that single multiple choice question.  Am I missing something to get actual form question data from the custom table that is built on the fly?

Here is the code I am using, including what you provided:

var formsManager = FormsManager.GetManager();
string entryTypeName = String.Format("0.1", "Telerik.Sitefinity.DynamicTypes.Model", "sf_motegireplacementpoll");
var itemType = formsManager.GetEntryType(entryTypeName);
 
int? totalCount = 0;
IEnumerable items = null;
try
    items = formsManager.GetFormEntries(itemType, string.Empty, string.Empty, 0, 0, ref totalCount);
     
    foreach (FormEntry item in items)
    
        //var entry = formsManager.GetFormEntry(entryTypeName, item.Id);
        this.results.Text += item.UserId;
    
catch

Posted by Community Admin on 17-Jun-2011 00:00

Hi Alex,

The code should return all fields. Please take a look at attached short video. Here is the code that was used during the video

void button1_Click(object sender, EventArgs e)
      
          var formsManager = FormsManager.GetManager();
          string entryTypeName = String.Format("0.1", "Telerik.Sitefinity.DynamicTypes.Model", "sf_yourformname");
          var itemType = formsManager.GetEntryType(entryTypeName);
 
          int? totalCount = 0;
          IEnumerable items = null;
          try
          
              items = formsManager.GetFormEntries(itemType, null, "Title ASC", 0, 100, ref totalCount);
          
 
          catch
          
 
          
      


Greetings,
Ivan Dimitrov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 20-Jan-2015 00:00

            MyResumesList model = new MyResumesList();
            //model.MyResumes = GetResumes();
            User user = userManager.GetUser(System.Web.HttpContext.Current.User.Identity.Name);
            List<MyResumesListModel> objMyResumesList = new List<MyResumesListModel>();
         
            //Get the Form by Name
            var form = formsManager.GetForms().Where(f => f.Name == "formName").SingleOrDefault();

            //Get the FormEntries for that Form
            
            var records = formsManager.GetFormEntries(form).Where(x => x.UserId==user.Id).ToList();

            // Loop through all the response records for this form
            foreach (FormEntry record in records)
           
                //Use GetValue() to obtain the Field value
                var FileName = record.GetValue("FileName");
                var DateUpdated = record.GetValue("DateUpdated");
                var Id = record.GetValue("Id");
                objMyResumesList.Add(new MyResumesListModel ResumeTitle = FileName.ToString(), DateUpdated = DateUpdated.ToString(), Id = Id.ToString() );
           

            return View("Default", objMyResumesList);

This thread is closed