We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3634
    • 19 Posts
    Another specific question.
    Following the tutorial "Adding Custom Fields to Manager Forms" from http://rtfm.modx.com/display/revolution20/Adding+Custom+Fields+to+Manager+Forms one will be able to add a simple html widget to get some input from the user. The process requires to hook in the 3 events of a resource editing: OnDocFormPrerender, OnDocFormRender and OnDocFormSave. And for a html widget like that it works fine. However if one would want to use a more complex widget making use of some java script to render some dom output after page loads, it will not work.
    Or at l;east it didn’t work for me.
    My approach was to:
    - register client startup script on OnDocFormPrerender that on Ext.onReady were loading and try to render a cuustom widget in a container
    - add the html content for the upper mentioned container on OnDocFormRender


    What I got was nothing because onDocFormRender it is mapped in js and it is executed after Ext.onReady so when my widget init function it is called the html container it is not there yet.

    So... is there a MODx js event on which I can hook to init my widgets, instead of Ext.onReady, that will be triggered after MODx.onDocFormRender ?


    Thanks.
      • 28215
      • 4,149 Posts
      Try:

      MODx.on('ready',function() { /* code */ });


      Only works on Resource pages.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3634
        • 19 Posts
        Yes, MODx.on(’ready’) that works, I have discovered in the mean time.
        Howsoever I think I will quit the idea of extending/altering the manager default create/update forms sad
        I think that hard coding the widgets for resource properties panel was not the best option for people that want to change things around.
        Using Form Customisation works some how (buggy: if you set to not use tabs in system settings, rules in form customisation are not working as expected) but displaying numerous widgets and tabs just to hide them after, it is looking strange.

        It is a great platform for a developer but if you want to create a stupiduser-friendly administration section, for people afraid of tree views smiley) I guess it is faster to do it from scratch somewhere in the front end.

        Thank you.
          • 3749
          • 24,544 Posts
          I’m not exactly sure what you want, but the NewsPublisher package might be worth checking out. It gives you a customizable create/edit resource page in the front end. You can launch NewsPublisher for a page with a link (I think -- haven’t tried it). You could definitely do it using a button next to each document title (see the NpEditThisButton snippet in the package).
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 3634
            • 19 Posts
            Thank you Bob, I will give it a try.

              • 4172
              • 5,888 Posts
              Quote from: bluehipy at Feb 01, 2011, 11:28 AM

              A CMP could do it but I really want to use everything that the manager is doing regarding the resource fields and TVs form update. Is there a easy way to reproduce that in a CMP?

              Thank you.

              perhaps you want to have a look how xdbedit and multiItemsGridTv does it.
              They use TV-input-types to edit fields the same way as in resource-editor.

              it may be also possible to use xdbedit’s grid for resources and edit them in a CMP if you need that.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!