We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21395
    • 91 Posts
    I want to use News Editor to allow front end users to notify back end managers of forthcoming events by creating MODx Resources.

    I’ve established a custom template that collects name, place, and details by using built-in fields like +pagetitle+ +title+ and +content+.

    I also want to capture start and end dates, and store them in such a way that EasyEvents can find them. To do so I need to put the dates into the template variables defined in my EasyEvents template.

    With me so far?

    News Editor happily captures all the data - (I’ve suborned the Javascript that picks up the published/unpublished dates which I don’t require), but I don’t know how to populate the not-yet-created document’s TVs. If that is possible. Nor do I know how to, or when to, find a just-created document, or to be precise the document I have just created, and populate its TVs as a second-phase approach.

    I’ve tried copying the "setTV" function from the CAKE API, but don’t seem to be able to pass the correct docid to the function - or I may be stuffing it up some other way - I’m no PHP programmer.

    It occurred to me that this can not be a new idea, and I did my usual hunt through the fora, but I’ve drawn a blank. Is it something basic? Or is it too hard?

    If someone has the time to drop me a hint, I’d be grateful.
      MODX Revolution 2.6.5-pl (traditional)

      Hosted on MODX Cloud

      Skype: nicbaldeagle
      • 3749
      • 24,544 Posts
      You might be able to get the ID of the newly created document with
      $_REQUEST['pid']


      If not, you’ll have to query modx_site_content table in the DB for the document by name and check its ID.

        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
        • 21395
        • 91 Posts
        Thanks Bob, I’ll give it a shot.



        Nic
          MODX Revolution 2.6.5-pl (traditional)

          Hosted on MODX Cloud

          Skype: nicbaldeagle