We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36573
    • 173 Posts
    So this what I have:
    [[!FormIt?
    &preHooks=`Formit2AjaxUpload`
    &hooks=`getpo,AjaxUpload2Formit`
    &ajaxuploadTarget=`OrderUploads/[[+poname]]`
    ...
    ]]


    with an input:
    <input type="text" class="poname" value="">
    


    And finally my custom hook (getpo):
    $modx->setPlaceholder('poname',$_GET['poname']);
    return '';
    


    Basically, I have an input for a PO name and I'd like to use it to create a folder name that the files upload to. Hence the placeholder [[+poname]] in the formit call. Granit, I could be way off. Thanks for any help.
      Everything I know I learned on the internet. Saved me thousands in College tuition,
      • 30585
      • 833 Posts
      Unless you want to display an error message, the hook should return true
      return true;
        A MODx Fanatic
        • 30585
        • 833 Posts
        And to access your form fields in a Hook, you should do something like this:
        $modx->setPlaceholder('poname',$hook->getValue('poname'));


        You also should also make sure your field has a name attribute, which is referenced by the hook's getValue method;
        <input type="text" name="poname" class="poname" value="">
          A MODx Fanatic