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

    I have a big problem (for me wink). I try to create a module with a form.
    When I valid my form, I obtain this error (displayed in a javascript box) :
    no record found for id 0

    Does someone know how fix it and what is my error ?

    Thanks
      Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
      • 33175
      • 711 Posts
      I can’t resolve it.
      Here is my html code :
                      <form name="module" method="POST">
                          <input type="hidden" name="opcode" value="add" />
                          <input type="hidden" name="id" value="" />
                          <label for="page_url">URL:<input type="text" name="page_url" value="" /></label>
                          <label for="type">Type:<select name="type"><option>Test</option></select></label>
                          <label for="item">Item:<input type="text" name="item" value="" /></label>
                          <input type="submit" name="add" onclick="postForm('add')" />
                      </form> 
      


      I really need help.

      Thanks.
        Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
        • 33175
        • 711 Posts
        I found the problem.
        We can’t use a field named "id" in a form....
          Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
          • 25663 MODX Staff
          • 12,272 Posts
          Good catach Guillaume... that’s any easy one to slip up on...
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 22303 MODX Staff
            • 10,725 Posts
            This is a problem I’ve run into again and again, especially working with database tables where the primary key is called ’id’. Moving forward, we are going to refactor the MODx core to not use id= to identify a requested document id, but for now, you need to avoid using id as $_POST or $_GET variables.
              • 33175
              • 711 Posts
              Quote from: OpenGeek at May 19, 2006, 10:03 AM

              This is a problem I’ve run into again and again, especially working with database tables where the primary key is called ’id’.
              Exactelly. It is my problem...
              Quote from: OpenGeek at May 19, 2006, 10:03 AM

              Moving forward, we are going to refactor the MODx core to not use id= to identify a requested document id
              I think this is a good idea or at the minus, the documentation should be updated to indicate this.
              Quote from: OpenGeek at May 19, 2006, 10:03 AM

              you need to avoid using id as $_POST or $_GET variables.
              I renamed my variable...
                Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !
                • 33175
                • 711 Posts
                I added a bug with the tracker : Error when using "id" for field name in a module. Thanks to vote wink

                The problem comes from the name of the module id. If this id was id_module (for example), the error doesn’t occure.

                It is really annoying when we work on the "id" property for a htlm tag.
                  Sorry for my english. I&#39;m french... My dictionary is near me, but it&#39;s only a dictionary !