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

    i got a fresh (MODX Revolution 2.2.9-pl (traditional) installation and added Formit 2.2.0 and Formit2db 1.1.0 via MODX's package manager.
    My barebone code looks like this:
    [[!FormIt?
    &hooks=`formit2db`
    &preHooks=`db2formit`
    &prefix=`modx_custom_`
    &packageName=`endlich`
    &tablename=`endlich`
    ]]
     
    <h2>Resource Form</h2>
    <p>[[+fi.error.error_message]]</p>
    <form class="form" action="[[~[[*id]]]]" method="post">
        <label for="name">
            Rennklasse:
            <span class="error">[[+fi.error.name]]</span>
        </label>
    
        <input id="name" name="name" type="text" value="[[+fi.name]]" />
    <div class="form-buttons">
            <input type="submit" value="Save" />
        </div>
    </form>
    


    Prior runnig this code i created the mysql table
    mysql> create table modx_custom_endlich (id integer auto_increment, name varchar(50), primary key (id));
    Query OK, 0 rows affected (0.07 sec)
    


    When i try to submit the form i get the following error:
    Failed to create object of type:

    MODX's error log says:
    [2013-09-19 15:24:37] (ERROR @ /modx-2.2.9-pl/index.php) addPackage called with an invalid package name.
    [2013-09-19 15:24:37] (ERROR @ /modx-2.2.9-pl/index.php) addPackage called with an invalid package name.
    [2013-09-19 15:24:37] (ERROR @ /modx-2.2.9-pl/index.php) No class specified for loadClass


    Somewhere i read that it's not packageName but packagename. If i run it with packagename the error log says:
    [2013-09-19 15:25:26] (ERROR @ /modx-2.2.9-pl/index.php) Path specified for package endlich is not a valid or accessible directory: /var/www/modx-2.2.9-pl/core/components/endlich/model/
    [2013-09-19 15:25:26] (ERROR @ /modx-2.2.9-pl/index.php) Path specified for package endlich is not a valid or accessible directory: /var/www/modx-2.2.9-pl/core/components/endlich/model/
    [2013-09-19 15:25:26] (ERROR @ /modx-2.2.9-pl/index.php) No class specified for loadClass


    As far as i unterstood everything i though that formit2db creates the necessary folders etc.
    The directory /var/www/modx-2.2.9-pl/core is completley writeable for everyone (chmod 777).
    What am i doing wrong?
      • 30912
      • 463 Posts
      Im not sure if formit still needs to send an email but my call looks like this and havent had any problems. this is from a 2.2.8pl install and i havent tried it on 2.2.9. It might be worth trying to get formit to work and submit the email first then add in the formit to DB

      Hope it helps.

      [[!FormIt?
      &hooks=`email,formit2db,redirect`
      &emailSubject=`Fast Question`
      &preHooks=`db2formit`
      &prefix=`cont_`
      &packageName=`contact_fast`
      &tablename=`fast_form`
      &emailTpl=`FastQuestionResult`
      &emailTo=`[email protected]    	    
      &redirectTo=`341`
      &submitVar=`fastqsub`
      ]]


      • The MODX formit2db/db2formit package manager extra does not autocreate packages/classes (xPDO models), which could be created by MIGX or CMPGenerator.