Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joachim Andersen 38 posts 198 karma points
    Jan 22, 2014 @ 13:47
    Joachim Andersen
    0

    Unable to render form in richtext editor 3.0.18.0 (Umbraco 7)

    Hi,

    I have two problems with Contour:

    1) When selecting insert macro from a richtext editor I only get a list of radio-buttons - no name 2) I get the following error displayed in the richtext editor when selecting a random form:

    2014-01-22 13:38:22,309 [6] WARN umbraco.macro - [Thread 21] Error loading MacroEngine script (file: MvcRenderContourForm.cshtml, Type: ''. Exception: System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.WebPages.WebPageBase.CreateInstanceFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage) at umbraco.macro.loadMacroScript(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

    Any idea for what is wrong?

    Cheers Joachim

  • Comment author was deleted

    Jan 22, 2014 @ 13:51

    Yeah was bug in 7, use 7.0.2 :)

  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 13:29
    Joachim Andersen
    0

    I've just upgraded to version 7.0.2 and still have problems.

    The first part is unchanged, while the second fails in another way - I get the following error now:

    The SessionStateTempDataProvider class requires session state to be enabled.

    I have the following in my web.config:

    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>
    

    Any ideas to what might be wrong?

    Cheers Joachim

  • Comment author was deleted

    Jan 28, 2014 @ 19:48

    Hmm not sure, is that something custom you placed in the web.config?

  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 20:15
    Joachim Andersen
    0

    No, I think its the default. This is what comes from the nuget package:

    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>
    

    But does that mean that you are unable to reproduce this problem? Can you say anything about which files I should check for, I mean which files should I double check if they have been updated correctly in the upgrade from 7.0.1 to 7.0.2?

    Cheers Joachim

  • Comment author was deleted

    Jan 28, 2014 @ 20:16
  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 20:18
    Joachim Andersen
    0

    Sure, I'll try it, but that will probably only have effect on the second, if any - but I'll give it a go and update here afterwards.

  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 20:29
    Joachim Andersen
    0

    I all ready have that in the web.config so that's a dead end.

  • Comment author was deleted

    Jan 28, 2014 @ 20:37

    And other macro's work fine in the rte? + the contour macro works fine when inserting in a template?

  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 21:01
    Joachim Andersen
    0

    Other macros work fine. And if I put it in the template the following is generated:

    That fails off course because of the missing FormGuid. If I pick a guid from the UFForms table it get the form rendered so it seems to be a problem related to the form picker paremeter editor.

  • Joachim Andersen 38 posts 198 karma points
    Jan 28, 2014 @ 21:02
    Joachim Andersen
    0

    The Form Picker data type is set to use the property editor with the following alias: FormPicker

  • Comment author was deleted

    Jan 29, 2014 @ 09:47

    Yeah that's fine

  • Comment author was deleted

    Jan 29, 2014 @ 10:34

    But check the insert form from umbraco contour macro, params tab, how does that look? Does it also use the form picker (it should)?

  • Joachim Andersen 38 posts 198 karma points
    Jan 29, 2014 @ 11:07
    Joachim Andersen
    0

    It is set to use the From Picker, and it also shows a list of radio buttons, one per form created in contour.

  • Joachim Andersen 38 posts 198 karma points
    Jan 31, 2014 @ 09:35
    Joachim Andersen
    0

    Hi Tim,

    Do you have any idea about what I can do? This is the last issue I have on a project which should go live once this works.

    I think it worked when I first installed Contour on Umbraco 7.0.0 so maybe it is related to the upgrade to 7.0.1 or 7.0.2, do you have any suggestions?

    I haven't created a bug report yet, should I do that?

    Cheers Joachim

  • Comment author was deleted

    Feb 06, 2014 @ 11:28

    Yeah upgrade to 7.0.3 should solve it

  • Joachim Andersen 38 posts 198 karma points
    Feb 07, 2014 @ 21:52
    Joachim Andersen
    101

    I figured it out . . .

    The problem is that the data returned to the controller is modified because a component (that I haven't coded my self) uses the CamelCasePropertyNamesContractResolver. This is a problem because the form picker view expects that the properties of the returned object have the first letter capitalized.

  • Zac 223 posts 575 karma points
    May 28, 2014 @ 11:44
    Zac
    0

    I'm having the same issue I believe (Umbraco 7.1.2), I had Contour 3.0.19 but I've pasted over the upgrade to 3.0.21 which made no difference.

    The macro parameters seemed to be missing the FormGuid parameter, and when trying to add it I get this error in the backend:

    Cannot insert duplicate key row in object 'dbo.cmsMacroProperty' with unique index 'IX_cmsMacroProperty_Alias'.
    
    
    
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +392
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +138
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6738869
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +6741487
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +586
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +107
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +270
       StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:299
       Umbraco.Core.Persistence.<>c__DisplayClassa.<ExecuteScalarWithRetry>b__9() +159
       Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction(Func`1 func) +545
       Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) +2877
       Umbraco.Core.Persistence.Database.Insert(Object poco) +58
       Umbraco.Core.Persistence.Repositories.MacroRepository.PersistUpdatedItem(IMacro entity) +413
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) +251
       Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action`1 transactionCompleting) +395
       Umbraco.Core.Services.MacroService.Save(IMacro macro, Int32 userId) +222
       umbraco.cms.presentation.developer.editMacro.macroPropertyCreate(Object sender, EventArgs e) +1136
       System.Web.UI.Page.RaiseChangedEvents() +105
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3572
    
  • Zac 223 posts 575 karma points
    May 28, 2014 @ 12:23
    Zac
    0

    Update to my last post - I upgraded to Umbraco 7.1.3 in order to try and sort this. I'm getting slightly further now - the macro no longer errors when saving it (and the FormGuid Form Picker is in the parameters tab).

    Now, when adding the Macro to a page, I can select the appropriate form, so that's nice. But I then get object reference not set to an instance of an object still, after I've chosen the form.

  • Tobias 9 posts 29 karma points
    Jun 02, 2014 @ 18:28
    Tobias
    0

    Hi,

    Same issue, Umbraco 7.1.4

    //Tobbe

  • Johan 188 posts 380 karma points
    Aug 19, 2014 @ 15:34
    Johan
    0

    I too get Object reference not set to an instance of an object. in the RTE.

    Running Umbraco 7.1.4 and Contour 3.0.21.

  • Sunnefa Lind 29 posts 85 karma points
    Aug 20, 2014 @ 11:31
    Sunnefa Lind
    0

    Is there any solution available for this error? This is happening to me too, I have Umbraco 7.1.3 and Contour 3.0.21. I have gotten so far as to figure out that this has something to do with Contour security but I can't seem to solve it. I can add all users to Contour security except for the "superadmin" (the user with id 0) and I always get a null reference error when trying to use the form picker...

  • Dejan Ostojic 10 posts 54 karma points
    Aug 27, 2014 @ 12:11
    Dejan Ostojic
    0

    Any news regarding this issue? I'm using Umbraco 7.1.4 and experiencing the same issue: "Object reference not set to an instance of an object." when I add a Contour form in an RTE field. This issue is blocking me from the further development and progress on the project that I'm working on. Could somebody let me know how this issue can be fixed? Thanks in advance.

  • Comment author was deleted

    Aug 27, 2014 @ 12:21

    Hi,

    So far we have been unable to reproduce the error. Does this also happen with a fresh 7.1.4 install? And how does it behave when you add it to a template?

  • Comment author was deleted

    Aug 27, 2014 @ 12:25

    Ok tried it again and I can now reproduce, it does render the form fine on the frontend, does it also do that in your case?

  • Sunnefa Lind 29 posts 85 karma points
    Aug 27, 2014 @ 12:25
    Sunnefa Lind
    0

    Hi, for me this happens on a fresh install and it behaves the same way if I put it in a template. As far as I can see it seems to have an issue with Contour security where it cannot add pre-existing users to Contour security but any users created after Contour is installed will be added there and will not experience this problem. The stack trace I get from the Form picker property editor (which will not render at all) seems to indicate that the problem is somewhere in "HasAcessToForm" method or something similar.

  • Comment author was deleted

    Aug 27, 2014 @ 12:28

    So the form doesn't render on the frontend in your case? 

  • Dejan Ostojic 10 posts 54 karma points
    Aug 27, 2014 @ 12:29
    Dejan Ostojic
    0

    Hi Tim,

    Thank you for a quick response.

    It's happening with a fresh 7.14 install. The form does not render in an RTE field: http://screencast.com/t/0RyGgt5Ot0ld, and I caught the same excaption while I was debigging the source code of Umbraco: http://screencast.com/t/NXFCElnZkX.

    Does this help you?

    Thanks,
    Dejan 

  • Sunnefa Lind 29 posts 85 karma points
    Aug 27, 2014 @ 12:31
    Sunnefa Lind
    0

    No, I only get "object reference not set to instance of an object" on the front end as well. I can create forms all right, but I cannot insert them into an RTE using the form picker because the form picker does not render and I cannot view them on the front end because there I get the object reference error.

  • Comment author was deleted

    Aug 27, 2014 @ 12:31

    Yup thanks for the details , will investigate the issue

    Could you should let me know if this affects the rendering of the form on the frontend, does it still display there?

  • Dejan Ostojic 10 posts 54 karma points
    Aug 27, 2014 @ 12:37
    Dejan Ostojic
    0

    It does not render on the front end page. Could you let me know when approximetelly you will be able to get back to me with a fix for this issue? I just need to inform the client about that as release of the project that I've been working on directly depends on this issue.

    Thanks,
    Dejan 

  • Comment author was deleted

    Aug 27, 2014 @ 12:59

    Also in 7.1.5 so checking it with the core team now since it's due to changes to the Umbraco Core

  • Comment author was deleted

    Aug 27, 2014 @ 13:13

    Ok on a fresh install the form picker seems to be working, but of course you need to have some forms your current user has access to, if you are an admin you should have access to everything.

    The error I get is inside the rte, the Object reference not set to an instance of an object.

    But the form still works fine on the frontend so the issue here is that the form doesn't render a preview in the RTE but renders an error instead

     

  • Dejan Ostojic 10 posts 54 karma points
    Aug 27, 2014 @ 13:23
    Dejan Ostojic
    0

    What Umbraco version have you used to test it?

    I'm using Umbraco 7.1.4 and on front end page I only have the following line rendered:
    <!--?UMBRACO_MACRO macroAlias="umbracoContour.RazorRenderForm" FormGuid="e11d5ed4-73a8-423c-a956-978d334ae0ac" /--> 

    but there's no the form.

  • Robby Cowell 20 posts 103 karma points
    Aug 27, 2014 @ 18:18
    Robby Cowell
    0

    We had the same issue and resolved it by manually fixing the JSON so each property name began with an uppercase.

  • Dejan Ostojic 10 posts 54 karma points
    Sep 04, 2014 @ 17:24
    Dejan Ostojic
    0

    @Robert, what JSON you've had updated?

  • Dejan Ostojic 10 posts 54 karma points
    Sep 08, 2014 @ 13:19
    Dejan Ostojic
    0

    @Time and Robert: sorry for making a presure on you but could you get back tome either with a patch or a quick fix for this issue? I'm currently stuck on the project that I'm working on and need this issue solved as soon as possible. 

    Any update is much appriciated. Thank you.

  • Sunnefa Lind 29 posts 85 karma points
    Sep 18, 2014 @ 15:39
    Sunnefa Lind
    0

    Hi, is there any news on this issue yet? Like Dejan, I am stuck on a project that is 99% complete except for this bug. Any workarounds that you can think of are greatly appreciated :-)

  • Robby Cowell 20 posts 103 karma points
    Sep 22, 2014 @ 17:36
    Robby Cowell
    1

    Dejan and Sunnefa, here's a more detailed explanation of how we fixed the problem.

    Ok, so as the accepted answer on this thread states, this problem occurs if you're using the CamelCasePropertyNamesContractResolver. In this case it is changing our Json data field names to lowercase, so Id becomes id, when Contour is expecting these to be upper case.

    We iterated through the names and changed them to start with an upper-case character. This is quite a hacky solution, and I'm sure there's a better way of doing this, but my solution was to open formpicker.controller.js (in App_Plugins/Contour), code should look like this:

    angular.module("umbraco").controller("Contour.FormPickerController",
            function ($scope, $http) {
    
                $scope.loading = true;
                $http({ method: 'GET', url: 'Contour/FormsApi/GetAll' })
                    .success(function (data) {
                        $scope.forms  = data;
                        $scope.loading = false;
                    })
                    .error(function () {
                        $scope.error = "An Error has occured while loading!";
                        $scope.loading = false;
                    });
            });
    

    Within the .success(function (data) { block we added the following code, which resulted in our amended version of this script looking like this:

    angular.module("umbraco").controller("Contour.FormPickerController",
        function ($scope, $http) {
    
    
            $scope.loading = true;
            $http({ method: 'GET', url: 'Contour/FormsApi/GetAll' })
                .success(function (data) {
    
                    var upperCaseData = [];
    
                    for (var i = 0; i < data.length; i++) {
                        var form = data[i];
                        upperCaseData.push({
                            "Id": form.id,
                            "Name": form.name,
                            "Fields": form.fields
                        });
                    }
    
                    $scope.forms  = upperCaseData;
                    $scope.loading = false;
    
                })
                .error(function () {
                    $scope.error = "An Error has occured while loading!";
                    $scope.loading = false;
                });
        });
    

    What we're doing is creating a new array, taking the original data variable, and for each entry, changing the property identifier to an upper case character, once we've looped through the data and changed the characters to upper case, we then assign this new array to $scope.forms, rather than the original which contains the lowercase property names which will break Contour. Quite simple once you know what the actual problem is!

    Hopefully that makes sense and will be enough for you guys to get things sorted, good luck! :)

  • Comment author was deleted

    Apr 07, 2015 @ 09:51

    @awn and does it work when you place it on a template?

  • awn 2 posts 22 karma points
    Apr 07, 2015 @ 13:04
    awn
    0

    @Tim yes its working fine when i added macro to template. But what about RTE?

  • Comment author was deleted

    Apr 07, 2015 @ 14:41

    And what happens if you disable rendering of the macro in the rte does it work fine then?

  • awn 2 posts 22 karma points
    Apr 07, 2015 @ 14:50
    awn
    0

    @Tim When i added that macro to Template and not in RTE then its working fine but when i add macro to RTE not in Template then its throwing same exception.

     

  • Comment author was deleted

    Apr 07, 2015 @ 15:04

    Also when the macro is set not to render in the rte?

  • Apeksha 1 post 21 karma points
    Jun 11, 2015 @ 12:07
    Apeksha
    0

    Hi Tim,

    I have the same issue. My umbraco version is 7.1.4 and my contour version is 3.0.27. When I put the form on the RTE I get the following error "The SessionStateTempDataProvider class requires session state to be enabled." But the form is getting displayed on the front end without any issue.

    Please help.

Please Sign in or register to post replies

Write your reply to:

Draft