We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52464
    • 14 Posts
    Dear Modx Community,

    As an exercise, I have created a resource with a form as content. I'm trying to submit the form and grab a single 'id' value on another resource.

    For this purpose, I'm using FormIt on the first resource and FormItRetriever for the second.
    After I submit the form, the page doesn't load and shows the Error page I set for 404 errors.

    Furthermore, the anchor link that I have on the first resource doesn't fail and takes me to the second resource with no problems. It doesn't retrieve the form but prints 'Hello', meaning that something is not working specifically with FormIt and FormItRetriever.

    Here is the code of the first resource:

    [[!FormIt?
       &submitVar=`edit`
       &hooks=`redirect`
       &store=`1`
       &redirectTo=`5`
    ]]
    
    <form action="[[~[[*id]]]]" method="post">
    <input type="text" name="id"/>
    <input type="submit" value="edit" name="edit"/>
    </form>
    
    <a href="[[~5]]">Go to Resource 5</a>
    


    The code on the second resource:

    Hello
    [[!FormItRetriever]]
    [[!+fi.id]]
    


    The details of the installation in my localhost:
    Modx Revolution 2.5.7 with ACE, Formit and the snippet CreateXpdoClasses.
    Xampp v3.2.2

    I have friendly URLs off and I'm following a tutorial made by Bob Ray, about creating and using custom data base tables. I was experimenting with form submissions alongside reading the tutorial.

    Please help me finding what I'm doing wrong.
    I really appreciate your help!!

    This question has been answered by lkfranklin. See the first response.

    • discuss.answer
      • 17301
      • 932 Posts
      Hi,

      I did some testing and it doesn't seem to like it if you use 'id'. If you change it to anything else then it'll work fine.

      [[!FormIt? 
      &hooks=`redirect` 
      &redirectTo=`5` 
      &store=`1`
      ]] 
      
      <form action="[[~[[*id]]]]" method="post">
      <input type="text" name="wtf" placeholder="wtf">
      <input type="submit" value="Submit" />
      </form>


      Hello
      [[!FormItRetriever]]
      [[!+fi.wtf]]
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 52464
        • 14 Posts
        Thanks a lot LK!! That solved my problem...
        It was an easy fix; but at the same time, not very obvious.

        I guess that the word "id" must be a reserved term for Modx.