-
☆ A M B ☆
- 30 Posts
I'm learning plugin writing in MODx Revolution and so I have question: In my plugin I want to get some fields of panel when new Template is creating. For example, the name of the template. So this name while typing would appear in the field "static file name" if the checkbox "Static" is checked. But the problem is that I don't understand how to get these fields via js.
-
☆ A M B ☆
- 30 Posts
Ok... let I try to explain by steps.
1) Login to Modx Manager
2) Go to Elements -> Templates -> create new template
3) Now we have a panel for creation new template as in image
4) How to get and set values of fields Name, Description, Is static and so on?
5) How to catch events when these fields are being changed?
-
☆ A M B ☆
- 24,524 Posts
Are you trying to set up a custom template creation form?
-
☆ A M B ☆
- 30 Posts
I'm trying to create plugin on event OnTempFormRender, OnChunkFormRender and so on. It will set appropriate Media Resource and file name when I click checkbox "Is static".
-
☆ A M B ☆
- 894 Posts
If you want to change the name of fields you can do that with form customization try checking out my
Form Customization tutorial on CMSTricks
-
☆ A M B ☆
- 24,524 Posts
I think what he wants is to automatically assign (or even create?) a file and a media source when creating a static template. That would take some pretty tricky manipulation of the template editing form. I don't think there's an easy way to do that.
-
☆ A M B ☆
- 30 Posts
Yes, only assign. If for example my Template name is MyTemplate then if I check Is Static the file name in appearing edit input has already set as MyTemplate.php or other extension that set in the system settings. Same as for media resource. One time to set in system settings relations TemplateMediaResource - Template, ChunkMediaResource - Chunk and so on, and I don't need to set them every time when I create new Elements.