We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48131
    • 1 Posts
    Hi all,

    I have a very very simple form. an email address. dont get any simpler. How in the hell do i get the email textbox to populate from a link?

    for example: www.mysite.com/[email protected].

    I can do this all day long in NORMAL html website, but get me in this modx junk and im lost!(so far my modx experience has been crap, not trying to be rude, just explaining my experiences)

    I have read many forums and have tried all the tutorial I have found online and they all seem to lack important info for beginners.

    Bottom line, I would rather go the dentist and pull all of my teeth out then deal with modx... sorry guys. Hopefully this so called wonderful community will help me and turn my experiences around.
      • 42046
      • 436 Posts
      FormIt is for sending forms. If you want to inject url parameters into html pages, use the GetUrlParam addon: http://rtfm.modx.com/extras/revo/geturlparam

      <form action=etc etc>
      <input type="text" name="email" id="email" value="[[!getUrlParam? &name=`email` &max=`50`]]" />
      <input type="submit etc etc>
      </form>


      FYI, passing url parameters with html alone isn't possible, you need some type of server side scripting. [ed. note: absent42 last edited this post 12 years, 3 months ago.]
        • 3749
        • 24,544 Posts
        Try this:

        Put this tag near the top of the page:
        [[!SetEmail]]


        Create a snippet called SetEmail with this code:

        <?php
        if (isset($_GET['email'])) {
            $modx->setPlaceholder('presetEmail', $_GET['email']);
        }


        Put this tag in the form where you want the email to appear:

        [[+presetEmail]]


        The snippet tag must be above the placeholder tag.

        Welcome to MODX. smiley

        BTW, I personally find FormIt kind of frustrating, though many people use and love it. I usually roll my own forms and form processing code. Once you get used to the fact that you can't use raw PHP code in MODX, things get a lot easier. It's a pain at first, but eventually, you grow to love it because it generally simplifies the design and makes things easier to maintain (it's also more secure).

        [ed. note: BobRay last edited this post 12 years, 3 months ago.]
          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