We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18913
    • 654 Posts
    I can’t seem to find this question asked or answered via Google, so I apologize if this is in fact treading old ground ...

    I’m using eForm in a couple of instances to present a form based on data in a database. Add, Update and Delete instances, specifically. In the case of "Add" only one form field needs to be prepopulated and I have a function that does that using the entries in a template variable. In the case of "Update" and "Delete" the fields related to the database need to be populated, in addition to the field just referenced in "Add."

    So I have a working function that populates the field from the TV and a working function that populates the fields related to the database. Rather than add yet-again the code from the first function to the second function, I would like to just call the first function and then the second function in the case of "Update" and "Delete."

    The "OnBefore" parameter in eForm takes as a reference only one function (vs. say a comma-separated list of functions to execute). So what I thought I could do is just make some sort of a reference/call to the first function from within the second one.

    But I can’t seem to get the syntax correct. Can anyone shed some light on this? I realize that this isn’t exactly a very critical problem but if there’s a way to do this, I’d be interested in hearing about it...

    Thanks,
    MattC
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Not as far as I know; just put all the code in the one function and use a switch structure in the function to determine when to do what.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org