Ok thanks for the details, would it be possible to send a backup of the site to tg at umbraco dot com then I can debug and fix the issue since I can't reproduce atm
Seems I didn't test my customized field-type in the backend. What I miss to implement, that user can also edit records in the backend?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Forms.Core;
using Umbraco.Forms.Core.Attributes;
using Umbraco.Forms.Core.Providers.FieldTypes;
namespace easyPush.Contour.CustomFieldType
{
/// <summary>
/// Label field.
/// </summary>
public class Label : FieldType
{
private MarkdownSharp.Markdown markdown = new MarkdownSharp.Markdown();
[Setting("Text", description = "Enter text as HTML", control = "Umbraco.Forms.Core.FieldSetting.TextArea")/**, assembly = "easyPush.Contour", control = "easyPush.Contour.FieldSetting.UnvalidatedTextArea")**/]
public string Text { get; set; }
public Label()
{
Id = new Guid("42E2850C-E6FB-439C-B04B-3E36C6DE2CDF");
Name = "Label";
Description = "This is a static text. Please enter your text in Markdown.";
Icon = "textarea.png";
}
public override string RenderPreview()
{
return markdown.Transform(Text);
}
public override string RenderPreviewWithPrevalues(List<object> prevalues)
{
return markdown.Transform(Text);
}
}
}
Ah ok, it's because the edit functionalitly is using the webforms version of the form and that isn't implemented, will see if I can change it so the razor version is used that way you don't need to add anything additional
Ok looked a bit more in the issue, moving the edit away from webforms will be something we'll do for version 4, so the option you have now is to add the following to your fieldtype
publicoverride System.Web.UI.WebControls.WebControl Editor { get { System.Web.UI.WebControls.Panel pnl = new System.Web.UI.WebControls.Panel(); pnl.ID = "pnlHolder";string actualText = ParseTokens(TextToShow); var md =newMarkdownSharp.Markdown(); pnl.Controls.Add(new System.Web.UI.LiteralControl(md.Transform(Text)));
return pnl; } set { base.Editor = value; } } publicoverride List<object> Values { get { Value.Clear(); Value.Add(string.Empty); return Value; } set { Value = value; } }
In the other custom field types I inherit from your field types (TextField, CheckBox etc.) - so everything was implemented. But especialy for this Field-Type I used your abstract class, and because Editor is marked virtual everything compiled but during runtime, there wasn't any implementation.
I hope everything can be migrated to Razor, so I don't have to deal with webforms.
Contour Error by editing a record
Hi
We use Umbraco 7.1.6 and Contour 3.0.21. Some Backend-User guys reported me this error, while editing one record in Contour.
I don't have any idea what happens here? Perhaps some fields do some trouble - perhaps they edited some formular stuff?
Best regards.
[NullReferenceException: Object reference not set to an instance of an object.] Umbraco.Forms.UI.Usercontrols.RenderForm.RenderField(Object sender, RepeaterItemEventArgs e) +2338 System.Web.UI.WebControls.Repeater.OnItemDataBound(RepeaterItemEventArgs e) +111 System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +138 System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +9517195 System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +61 System.Web.UI.WebControls.Repeater.DataBind() +50 Umbraco.Forms.UI.Usercontrols.RenderForm.RenderFieldset(Object sender, RepeaterItemEventArgs e) +698 System.Web.UI.WebControls.Repeater.OnItemDataBound(RepeaterItemEventArgs e) +111 System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +138 System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +9517195 System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +61 System.Web.UI.WebControls.Repeater.DataBind() +50 Umbraco.Forms.UI.Usercontrols.RenderForm.RenderUi() +2305 Umbraco.Forms.UI.Usercontrols.RenderForm.OnInit(EventArgs e) +271 System.Web.UI.Control.InitRecursive(Control namingContainer) +134 System.Web.UI.Control.AddedControl(Control control, Int32 index) +191 System.Web.UI.ControlCollection.Add(Control child) +86 Umbraco.Forms.UI.Dialogs.previewFormDialog.OnInit(EventArgs e) +975 System.Web.UI.Control.InitRecursive(Control namingContainer) +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +489
I would raise that as a bug, should be handling a null exception :). It feels like that record is not there or has been deleted from the database.
Charlie
Comment author was deleted
Does this happen for a specific record or all records? And on all forms or on a specific form?
It happens for all records on specific forms. But not all forms seems to be affected. I don't know all mutations the user did on those affected forms.
Comment author was deleted
Ok thanks for the details, would it be possible to send a backup of the site to tg at umbraco dot com then I can debug and fix the issue since I can't reproduce atm
Seems I didn't test my customized field-type in the backend. What I miss to implement, that user can also edit records in the backend?
FieldType.Label.cshtml
Comment author was deleted
Ah ok, it's because the edit functionalitly is using the webforms version of the form and that isn't implemented, will see if I can change it so the razor version is used that way you don't need to add anything additional
Comment author was deleted
Ok looked a bit more in the issue, moving the edit away from webforms will be something we'll do for version 4, so the option you have now is to add the following to your fieldtype
Thank you very much!
After implementing the editor property everything works now.
Best regards.
Now everything solved.
In the other custom field types I inherit from your field types (TextField, CheckBox etc.) - so everything was implemented. But especialy for this Field-Type I used your abstract class, and because Editor is marked virtual everything compiled but during runtime, there wasn't any implementation.
I hope everything can be migrated to Razor, so I don't have to deal with webforms.
Comment author was deleted
Great, glad for confirming it works :)
is working on a reply...