We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 77
    • 8 Posts
    I am new to MODx and am having issues with things that I am sure are very simple. Below is my problem...

    I have created a snippet and this snippet is very simple. its checks to see if a varriable exists, and if not, shows a form. When I submit that form to the same page, it should revert back to just show that varriable... It’s not doing that. I have tried submitting the form with POST, GET, REQUEST. Still no luck. I have placed the snippet in the TV, I have placed it in a chunk. I do not know what I am doing wrong. I also have submitted the form to different places, such as the actual path, the relative path, the rewritten-url path and the MODx var ([~page_num~]). Please help.

    My questions:

    1. When submitting a form, I would like to use POST. Can I?
    2. Whan I actually submit the form and want it to go to the same page or any other page, how do i do that in MODx?
    3. When recalling a varriable, I would normally use $_POST[var]. Is this correct?
    4. When assigning sessions, Do I do anything different that the usual $_SESSION[var] = $_POST[var]; ?

    Thank you all for this great system. I feel that when I get the hang of it, I will really benefit and become a better developer.

    Chad
      • 22303 MODX Staff
      • 10,725 Posts
      All of it should work if you call the snippet uncached:
      [!NonCacheableSnippetCall!]
      [[CacheableSnippetCall]] 
      

      or make sure the page you call it on is not cacheable.
        • 3749
        • 24,544 Posts
        Quote from: 2hmedia at Jan 25, 2009, 10:01 AM

        2. Whan I actually submit the form and want it to go to the same page or any other page, how do i do that in MODx?

        To a page with the id of 12:
        <form action="[~12~]" etc. >

        To self:

        <form action="[~[*id]~]" etc.>


        There are some more snippet tips here: http://bobsguides.com/modx-snippet-faq.html
          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
          • 77
          • 8 Posts
          Thank you both so much... I have learned so much in just the past six hours playing around and browsing the forums... Great FAQ by the way...

          Both responses paid off for me.

          I look forward to learning more as I grow with MODx.