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

Answered Formit2db + Migx

    • 48657
    • 17 Posts
    Hey guys, i just got through the Migx tutrial of creating a CMP (http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials/migxdb.create-doodles-manager-with-help-of-migxdb)

    Now i want to insert content from a Form into this DB
    Therefore i created Test-Code

    <div class="container">
    [[!FormIt? 
    	&hooks= `formit2db` 
    	&preHooks=`db2formit`
    	&prefix=`modx_`
    	&packageName=`doodles`
    	&tablename=`doodles`
    	]] 
    	
    	<h3>[[!+fi.successMessage]] [[+fi.error.error_message]]</h3>
    <div class="wrap">
    <form action="[[~[[*id]]]]" method="post">
    <div id="name">
    <label for="name">Name:</label>
    <div class="controls">
    <input class="input-block-level" type="text" name="name" value="[[!+fi.name]]" /></div>
    </div>
    <input class="btn btn-primary" type="submit" value="Submit" /></form></div>
    <p> </p>
    </div>


    But i keep receiving an error (Failed to create object of type: )

    regards

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      try:

      [[!FormIt?
          &hooks= `formit2db`
          &packagename=`doodles`
          &classname=`Doodle`
      ]] 
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 48657
        • 17 Posts
        <div class="container">
        [[!FormIt?
            &hooks= `formit2db`
            &packageName=`doodles`
            &classname=`Doodle`
        ]]
        	
        	<h3>[[!+fi.successMessage]] [[+fi.error.error_message]]</h3>
        <div class="wrap"><form action="[[~[[*id]]]]" method="post">
        <div id="name"><label for="name">Name:</label>
        <div class="controls"><input class="input-block-level" type="text" name="name" value="[[!+fi.name]]" /></div>
        </div>
        <input class="btn btn-primary" type="submit" value="Submit" /></form></div>
        <p> </p>
        </div>


        I receive:
        Failed to create object of type: Doodle


        fyi: Table modx_doodle is created and testdata i inserted over CMP is shown correctly
        • discuss.answer
          • 4172
          • 5,888 Posts
          change
          &packageName=`doodles`


          to

          &packagename=`doodles`


          does this work?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 48657
            • 17 Posts
            nailed it, thanks