Custom module backend insert view doesn't show the toolbar
Hi,
I have created a custom module called "Employees" based on the products module. I implemented everything in the same way as in the products module. However when I go to create a new item scree (attached), it is not showing the complete toolbar containing Publish, Draft buttons and More Action link is not poping up. When i enter this page I get two allerts with only "undifined" as the text. Can someone please tell me what I have done wrong?
The sample module project is uploded to sendspace.com and can be downloaded using the link below.
http://www.sendspace.com/file/vfxea4
Thanks!
Duneel
Hi Duneel,
I got the same error as you. This bug is caused by workflows, the workflow is not found. You can see this using firefug and firecookie. I resolve this rebuilding my custom module because I don'k know where exactly to search the bug.
Hope it helps you!
Jocelyn
Hi Joeclyn,
Could you please tell me the steps you followed to fix this workflow issue?
Thanks!
Duneel
Hi,
I create my module again using one module which works. I don't know exactly what was my error, maybe in the name I gave to the workflow file or anywhere in the module where the workflow is references.
I'm sorry not to tell more.
How custom modules work are still strange to me regardings some features...
Jocelyn
Thanks Joeclyn!
Can Ivan or Radoslav please help us to get over this workflow issues we are facing with custom modules?
Thanks,
Duneel
Hello Duneel,
We examined the project you provided us and we found that your EmployeesWorkflow.xamlx is incorrect. There are a few unescaped quotes in the markup around the word ContentType:
<
p1:Variable
x:TypeArguments
=
"tsfa:IAnyDraftFacade"
Default
=
"[App.Prepare().SetContentProvider(providerName).WorkWith().AnyContentItem(contextBag("
ContentType"), itemId)]"
Name
=
"masterFluent"
/>
Hi Ivan,
Thanks for examining the module project and locating the error. Wow the module works like charm with the new workflow file. So then it was a problem with the workflow.
Thanks,
Duneel
Hi Ivan,
Just a quick thing. I changed my custom module and got-rid-of the Title field. And now I cannot publish the new items. A validation with the URL field fails everytimes I hit on publish since now I dont have the Title input field on create new form. How do I fix this issue? Is it a must to have a Title field in every module?
Thanks,
Duneel
Hello Duneel,
The problem you have described comes from the fact that the field control for UrlName is MirrorTextField which mirrored field is Title. Here is the code:
var urlName =
new
MirrorTextFieldElement(moreOptionsSection.Fields)
Title = Res.Get<EmployeesResources>().UrlName,
ID =
"urlName"
,
MirroredControlId = titleField.ID,
DataFieldName =
"UrlName"
,
DisplayMode = displayMode,
RegularExpressionFilter = DefinitionsHelper.UrlRegularExpressionFilter,
WrapperTag = HtmlTextWriterTag.Li,
ReplaceWith =
"-"
;
Thanks Ivan P! It resolved the my issue. I set the MirroredControlId to another field in my module.
Hi Ivan,
Along the same lines, is there a way to use two fields and still automatically mirror for the URL field? For instance, we have a firstname and lastname field and it would be great if the url field was automatically created like firstname-lastname.
Hi Kmac,
Our MirrorTextField supports only one mirrored field. You will have to implement a custom field if you want such functionality but it's not so difficult. Your field will have to listen for the JavaScript events of several fields and will need some sort of pattern or format for populating its value.
All the best,
Ivan Pelovski
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Thanks Ivan,
Do you happen to have some sample code to get started? I'm not sure where to begin.
Hi Kmac,
Here is a sample you can use for your development. It is based on the MirrorTextField and overwrites several methods in order to support more than one mirrored text field.
Best wishes,
Ivan Pelovski
the Telerik team
Thanks for the code. Pretty straightforward once you look at it. Of course now I have another question. When building a custom module, the definitions file needs a MirrorTextFieldElement. What do I need to do in order to actually add this MultiMirrorTextField to a backend section.
I tried this but it doesn't like that when I try to add it in the moreOptionsSection.Fields.Add(urlName);
var urlName = new MultiMirrorTextField()
Title = "UrlName",
ResourceClassId = typeof(PeopleResources).Name,
ID = "urlName",
MirroredControlId = firstNameField.ID,
MirroredControlIds = new string[] firstNameField.ID, lastNameField.ID ,
DataFieldName = (displayMode == FieldDisplayMode.Write) ? "UrlName.PersistedValue" : "UrlName",
DisplayMode = displayMode,
RegularExpressionFilter = DefinitionsHelper.SeoRegularExpressionFilter,
WrapperTag = HtmlTextWriterTag.Li,
ReplaceWith = "-"
;
Hello Kmac,
In order to use this field in module definitions, you will have to implement a field definition config element and a field definition. To do this just override the MirrorTextFieldElement and MirrorTextFieldDefinition classes and add the extra properties from the multi mirror text field. You will also have to override the Configure method in MultiMirrorTextField to set the properties coming from the definition. Look at the UrlMirrorTextFieldElement, UrlMirrorTextFieldDefinition and UrlMirrorTextField as a reference for your code.
Kind regards,
Ivan Pelovski
the Telerik team