We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37099
    • 338 Posts
    If you are writing a custom hook for FormIt and want to be able to pass it variables in the FormIt tag like this:

    [[!FormIt?
       &hooks=`myCustomHook,spam,email,redirect`
       &myVariable1=`5`
       &myVariable2=`10`
    ]]
        
    


    Then you can access the variables in the hook code like this:

    $myVariable1= $modx->event->params['myVariable1'];
    $myVariable2= $modx->event->params['myVariable2'];
    


    It took me a few hours to find that out. Hope it saves you some time.

    Mike
      • 4172
      • 5,888 Posts
      like in any other snippet, you can get the properties with the $scriptProperties - array, in a formit-hook-snippet.

      $myVariable1 = $modx->getOption('myVariable1', $scriptProperties, '');
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37099
        • 338 Posts
        Quote from: Bruno17 at Jul 22, 2014, 06:25 AM
        like in any other snippet, you can get the properties with the $scriptProperties - array, in a formit-hook-snippet.

        $myVariable1 = $modx->getOption('myVariable1', $scriptProperties, '');

        I knew there'd be another way!!!

        Thanks
        Mike