November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Edward, you haven't shared your EditorDescriptor, I just want to make sure that you have something like this in your project before we go any further:
[EditorDescriptorRegistration(TargetType = typeof(JavascriptString), UIHint = Global.SiteUIHints.JavascriptString)] public class JavascriptStringEditorDescriptor : EditorDescriptor { public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes) { ClientEditingClass = "your/custom/dojo/property/edtior/path"; base.ModifyMetadata(metadata, attributes); } }
Thanks Bartosz, yes I have an EditorDescriptor already like this:
[EditorDescriptorRegistration(TargetType = typeof(JavascriptString), UIHint = SiteUIHints.JavascriptString)] public class JavascriptStringEditorDescriptor : EditorDescriptor { public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes) { ClientEditingClass = "app/editors/javascripteditor/JavascriptStringEditor"; base.ModifyMetadata(metadata, attributes); } }
I can give the widget javascript and template as well if that would help. But the actual control textarea is functioning, I have able to save the property as just a simple string. I just can't get it to save when I try to serialize and deserialize it as a JSON string.
Hi,
I'm trying to create a custom PropertyLongString based on a class that has 2 string properties. This is the guide I'm following: http://azanganeh.com/blog/2016/10/30/episerver-custom-property-in-simple-steps-by-step-example/. Whenever I try to save the property in the CMS editor, I get a validation error which doesn't help much:
Could not save property, and it has been reverted. Please try again.
Error converting value "console.log('hi');" to type 'Models.Properties.JavascriptString'. Path '', line 1, position 20. Could not cast or convert from System.String to Models.Properties.JavascriptString.
The editor control is just a simple textare based on dijit/form/TextBox.
Here's the JavascriptString class:
And the JavascriptStringProperty class:
Then I'm using this property like so:
I'm really not sure what the problem is here. Is there something wrong with the setter for the Value, or the SaveData() method (I'm not really sure when this method gets called, couldn't find any info on it)? Or maybe the PropertyValueType needs to be String? Any help would be great.