We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24991
    • 4 Posts
    Hi,

    I was just wondering if its possible to add javascript which fires on the OnDocFormRender event in a plugin, as just adding a <script> to the $e->output() results in the page breaking.

    Thanks in advance
      • 24991
      • 4 Posts
      So basically, is there a way of creating your own ’Form Customisation’ rule, for example one that adds tagging to a template variable? I have already made the code for the tagging and other rules, but I can’t work out how to get it to fire when the page is loading...
        • 26903
        • 1,336 Posts
        I think you have to add it in the head tag if I’m reading you right here, Frontpage does this, assuming $head contains your script line :-
        /* Place Frontpage head information in head, just before </head> tag */
                $output = preg_replace('~(</head>)~i', $head . '\1', $output);
        
        where $output would be $e->output() presumably.
          Use MODx, or the cat gets it!