Search code examples
javascriptmeteormeteor-autoform

Is there a way to use a custom button to add a value for Aldeed: Autoform


I have a meteor application where I am using Aldeed: Autoform to directly insert a generated form into a database based off of a schema. Is there a way that I can use my own custom button or input field instead of using the options provided by autoform? I desire to do so because I need to have an onclick function take place when one of the buttons is clicked, but the autoform button is not a normal button and I cant add the onclick attribut.

When I say the options provided I mean this:

{{> afQuickField name='game'}}

and I want to replace that with this somehow:

<button id="makeLobBtn" class="button" type="button" onclick="div_show()">Make Lobby</button>

Solution

  • Sure - you can use the {{#autoForm}} component to do this:

    {{#autoForm id="demo" schema=schema}}
      {{> afQuickFields}}
      <div>
        <button type="submit">Submit</button>
      </div>
    {{/autoForm}}