Fluent API Form Examples?

Posted by Community Admin on 05-Aug-2018 20:17

Fluent API Form Examples?

All Replies

Posted by Community Admin on 18-Apr-2011 00:00

Could you give a few examples on how to use the Fluent API with forms?

Queries needed:

 - List of form names
 - List of form entries for a particular form

Thanks,

Michael Snyder
ConnectionsAcademy.com

Posted by Community Admin on 22-Apr-2011 00:00

Hi ,

You have to use the standard API to get these results.

            FormsManager manager = FormsManager.GetManager();
            var forms = manager.GetForms();
            foreach (FormDescription d in forms)
           
                 var title = d.Title;
                  var name = d.Name;
               
           
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)


Greetings,
Ivan Dimitrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

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

Hi,

How do I add a value using Fluent API to the Form I created in CMS?

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

Hi Zubair,

Here is the programmatic way to add a new entry to a form

IManager manager;
manager = FormsManager.GetManager(providerName);
 
using (var fluent = App.WorkWith())
    var facade = fluent.Forms().Form(formName);
    facade.Do(fd =>
    
        fd.FormEntriesSeed++;
        entry.Item.ReferralCode = fd.FormEntriesSeed.ToString();
    );
 
 
entry.Item.SubmittedOn = DateTime.UtcNow;
entry.Item.UserId = SecurityManager.GetCurrentUser().UserId;
this.SetEntryIpAddress(entry.Item);
manager.SaveChanges();
ServiceUtility.DisableCache();


Regards,
Ivan Dimitrov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

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

Hi,

This is incomplete code and it breaks, can you please include full code with namespaces and also tell me how to add value for each form field?

Thanks,

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

Hi,

Any news?

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

Hi Zubair,

Have you specified the form name for which you want to add a new entry? You can get a refernce to the classes through Visual Studio Intellisense. It should shows you the missing reference in your class.

Best wishes,
Ivan Dimitrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

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

I know I can add a FormName but I cant find out the how the entry will look like, anyway I will look at this post to do the same.

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

@Ivan

In your code posted on June 20th you are adding the "entry" data.  Where and how are you setting this up?

entry.Item.SubmittedOn = DateTime.UtcNow;
entry.Item.UserId = SecurityManager.GetCurrentUser().UserId;
this.SetEntryIpAddress(entry.Item);
manager.SaveChanges();
ServiceUtility.DisableCache();

I have tried to add a form entry using the sample code and it doesn't work on my end.  Do you guys have a full sample in the SDK? 

Brett

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

@Brett,

I got this to work with the help of this post, though I changed it from extension method to a 'normal' method

www.sitefinity.com/.../how-to-use-createformentry.aspx

Telerik/Sitefinity team isn't helping :(

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

Hello,

There is also FormEntriesFacade which could be used to get IQueryable<FormEntry>

Best wishes,
Ivan Dimitrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Posted by Community Admin on 16-May-2017 00:00

What are references are needed for this formsmanager. 

 

Thanks 

Naman 

Posted by Community Admin on 17-May-2017 00:00

If you want to use FormsManager, you need to add this using:

using Telerik.Sitefinity.Modules.Forms;

 

Posted by Community Admin on 17-May-2017 00:00

Now what reference and dll is required for formsDescription ????

 

Posted by Community Admin on 17-May-2017 00:00

reference to Telerik.Sitefinity.dll 

Posted by Community Admin on 17-May-2017 00:00

Still Getting Error for FormDescription ??? 

Posted by Community Admin on 17-May-2017 00:00

I cannot read your mind. Please give me more details. What is the error, your code and etc

Posted by Community Admin on 17-May-2017 00:00

FormsManager manager = FormsManager.GetManager();
            var forms = manager.GetForms();
            foreach (FormDescription d in forms)
           
                var title = d.Title;
                var name = d.Name;

           
            return View();

 

Same code  I am using but on this line :-

foreach (FormDescription d in forms)  

 

getting error that FormDescription could not found (are you missing a using directive or an assembly reference) ???

Posted by Community Admin on 17-May-2017 00:00

add reference to Telerik.Sitefinity.Model.dll

I am not sure why, you have missing references to this basic dlls in your project

Posted by Community Admin on 17-May-2017 00:00

Thanks Its working now :)

Posted by Community Admin on 18-May-2017 00:00

Hi I need to ask if i am using this code in different application to get the form list from any website so how to pass website url in this code so can we get forms for that particular website. ? 

This thread is closed