meteoric autoform select-radio does not work

79 Views Asked by At

The field does not exists in the Schema of form, i am using ionic template in form, this code does not work to me:

Template.example.helpers({
    cardOptions: [
  { value: 0, label:'Visa' },
  { value: 1, label:'MasterCard' },
  { value: 2, label:'Elo' },
  { value: 3, label:'Hipercard' },
  { value: 4, label:'Hiper' }
 ]
});
<template name="example">
  {{> afQuickField name="payment.card" type="select-radio" options=cardOptions }}
</template>

1

There are 1 best solutions below

0
On BEST ANSWER

You need to use the autoForm component if you want to define fields individually.

For example:

<template name="example">
  {{#autoForm collection="Payments" id="insertPaymentForm" type="insert"}}
    <fieldset>
      <legend>Add a Payment Method</legend>
      {{> afQuickField name='title'}}
      {{> afQuickField name="card" type="select-radio" options=cardOptions }}
    </fieldset>
    <button type="submit" class="btn btn-primary">Insert</button>
  {{/autoForm}}
</template>

Here is a MeteorPad.