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)
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?
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.
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?
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.
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.
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...
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.
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?
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.
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.
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.
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
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" /-->
@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.
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 :-)
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:
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! :)
@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.
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.
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
Yeah was bug in 7, use 7.0.2 :)
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:
Any ideas to what might be wrong?
Cheers Joachim
Comment author was deleted
Hmm not sure, is that something custom you placed in the web.config?
No, I think its the default. This is what comes from the nuget package:
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
Could you give the answer here a try http://stackoverflow.com/questions/720367/the-sessionstatetempdataprovider-requires-sessionstate-to-be-enabled
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.
I all ready have that in the web.config so that's a dead end.
Comment author was deleted
And other macro's work fine in the rte? + the contour macro works fine when inserting in a template?
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.
The Form Picker data type is set to use the property editor with the following alias: FormPicker
Comment author was deleted
Yeah that's fine
Comment author was deleted
But check the insert form from umbraco contour macro, params tab, how does that look? Does it also use the form picker (it should)?
It is set to use the From Picker, and it also shows a list of radio buttons, one per form created in contour.
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
Yeah upgrade to 7.0.3 should solve it
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.
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:
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.Hi,
Same issue, Umbraco 7.1.4
//Tobbe
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.
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...
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
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
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?
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
So the form doesn't render on the frontend in your case?
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
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
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?
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
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
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
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.
We had the same issue and resolved it by manually fixing the JSON so each property name began with an uppercase.
@Robert, what JSON you've had updated?
@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.
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 :-)
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
becomesid
, 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:
Within the
.success(function (data) {
block we added the following code, which resulted in our amended version of this script looking like this: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
@awn and does it work when you place it on a template?
@Tim yes its working fine when i added macro to template. But what about RTE?
Comment author was deleted
And what happens if you disable rendering of the macro in the rte does it work fine then?
@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
Also when the macro is set not to render in the rte?
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.
is working on a reply...