0

I have a form

<template name="form">
  {{#autoForm id="afUpdateDemo" type=formType collection="Items" doc=selectedDoc autosave=autoSaveMode}}
    {{> afQuickField name="title"}}
    {{#unless autoSaveMode}}
      <div class="form-group">
        <button type="submit" class="btn btn-primary" disabled="{{disableButtons}}">Submit</button>
        <button type="reset" class="btn btn-default" disabled="{{disableButtons}}">Reset Form</button>
      </div>
    {{/unless}}
  {{/autoForm}}
</template>

I want this form to open in a modal window. So the modal should be active if selectedDoc is not null. How can I do this? In the bootstrap doc, they only show how to activate a modal window through a link.

I have also found https://atmospherejs.com/yogiben/autoform-modals but it will also only get active through a link.

Jamgreen
  • 10,329
  • 29
  • 113
  • 224
  • you will need an `autorun` to listen for the reactive var and when ever it's `true` open the modal or close :) –  Oct 16 '15 at 15:33

1 Answers1

0

The mizzao:bootboxjs package gives you this ability very directly from code.

if ( selectedDoc ) bootbox.dialog({
  .. your dialog definitions here
});
Michel Floyd
  • 18,793
  • 4
  • 24
  • 39
  • But where can I define my autoform? I was thinking of doing it directly in the template as `{{#if selectedDoc}} – Jamgreen Oct 17 '15 at 11:14
  • Fortunately I've already answered that question [here](http://stackoverflow.com/a/27436504/2805154) ;) – Michel Floyd Oct 17 '15 at 17:46