Error retrieving Form description

Posted by Community Admin on 04-Aug-2018 19:39

Error retrieving Form description

All Replies

Posted by Community Admin on 19-Oct-2011 00:00

Hello,

I my control I use this statement:
            if (!string.IsNullOrEmpty(FormName))
           
                using (var formsManager = FormsManager.GetManager())
               
                    var formDescription = formsManager.GetForms().Where(f => f.Name == FormName).SingleOrDefault();
                   ......
                
             
This works fine with Sitefinity 4.2.
But with Sitefinity 4.0 it gives the following error:

line 1:136: unexpected token: ["",<1>,line=1,col=136]
Original Query: DEFINE EXTENT extnt FOR Telerik.Sitefinity.Forms.Model.FormDescription; SELECT * FROM extnt AS t1 WHERE t1.appName = $1 AND t1.name =


[QueryException: line 1:136: unexpected token: ["",<1>,line=1,col=136]
Original Query: DEFINE EXTENT extnt FOR Telerik.Sitefinity.Forms.Model.FormDescription; SELECT * FROM extnt AS t1  WHERE t1.appName =  $1 AND t1.name =]
   Telerik.Sitefinity.Data.Linq.Oql.OqlQueryProvider`2.ExecuteKnownType(IObjectScope scope, String queryText, Boolean isEnumerable, Int32 skip, Int32 take, IList parameters, ElementOperator op) +1026
   Telerik.Sitefinity.Data.Linq.Oql.OqlQueryProvider`2.Execute(Expression expression) +585
   Telerik.Sitefinity.Data.Linq.QueryProvider`2.System.Linq.IQueryProvider.Execute(Expression expression) +115
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) +265
   Xperit.Sitefinity.Forms.FormsEntriesControl.InitializeControls(GenericContainer container) +815
   Telerik.Sitefinity.Web.UI.SimpleView.CreateChildControls() +58

Somebody any idea how to solve this in 4.0?

Thanks, Jaap

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

Hello Jaap,

Can you please let us know if FormName is the programmatic name of the form or its title that you've given when you created it? You can use the GetFormByName() method that should successfully return the form by its programmatic name:

var manager = FormsManager.GetManager();
var form = manager.GetFormByName("sf_myform");        
I've recorded a short video demonstrating how the code works on one of my Sitefinity 4.0 SP1 projects, please find it attached to this reply as well.

All the best,
Boyan Barnev
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 24-Oct-2011 00:00

Yes, GetFormByName solves the problem with Sitefinity 4.0.
Seems the linq query does not work fine with 4.0.

Jaap

This thread is closed