yogiben / meteor-autoform-modals

Adds modals to insert/update/delete Meteor collections
63 stars 41 forks source link

Multiple Autoform Modals in same Template produces error #27

Open etmarch opened 9 years ago

etmarch commented 9 years ago

I have two autoform modal templates right next to each other in the same template:

<li id="menu-item-dropdown" class="dropdown ">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
          <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add New
                <b class="caret">
                </b>
            </a>
      <ul id="menu-items" class="dropdown-menu">
        <li class="active">
          {{#afModal class="btn btn-primary" collection="Songs" operation="insert" omitFields="author,ownerId,createdAt,likes"}} Song {{/afModal}}
        </li>
        <li class="active">
            {{#afModal class="btn btn-primary" collection="Ads" operation="insert" omitFields="ownerId,createdAt"}} Performance Ad {{/afModal}}
        </li>
      </ul>
    </li>

I am receiving this error everytime I open the "Songs" modal.

Exception in template helper: Error: Invalid field name: audioFile
    at Object.getDefs (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:221:13)
    at Object.autoFormNormalizeContext [as normalizeContext] (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:525:20)
    at Object.afFormGroupContext (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:6110:30)
    at http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2727:16
    at http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1606:16
    at Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
    at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:106:25)
    at Object.Spacebars.dataMustache (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:138:39)
    at http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:6070:22
    at null.<anonymous> (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:261:18)

Any idea why this is happening? Thanks.

yogiben commented 9 years ago

The error is coming from AutoForm.

Can you create a regular {{#autoForm}} and see if it's still an issue?