We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I feel dirty running this as a prehook...

    foreach ($_POST as $key=>$value){
    
         $_POST[$key] = trim($value);
    
    }
    


    is there a better way to do this? the validation thing &strip=` ` or &strip=^ ^ does not work...

    -sean
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 1778
      • 659 Posts
      Hi,
      in a prehook ? !?
      The prehook is fired before the form is rendered (useful to prefiil fields), at this time the $_POST array is empty (nothing has been posted), if you want to do something with the posted values you have to use a posthook...
      Hope this helps
      Cheers
        • 26503
        • 620 Posts
        oops - sorry, fat fingers... it is a posthook.
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 27708 MODX Staff
          • 2,502 Posts
          Sean,

          I believe the correct usage is fieldname:strip=^^ but otherwise if you want to run a trim on every value that makes sense.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub