SergeBlackDog
SergeBlackDog

Reputation: 13

meteor autoform string array shows empty field

I make edit form for some collection, it has Array fields 'phones', each element is String When I trying to make afArrayField from this field it shows block with one empty string

Schema:

    {phones:
        {type: Array,
        minCount: 1,
        label: "Phones numbers"},
    {"phones.$":
        {type: String}
    }

Template:

    {{> afQuickField name="phones" value=phones}}

In object array 'phones' is presented

Upvotes: 1

Views: 506

Answers (1)

JVercout
JVercout

Reputation: 130

I've the following:

  phones: {
    type: [String],
    minCount: 1,
    label: "Phones numbers"
  },
  'phones.$': {
    autoform: {
      afFieldInput: {
        type: 'text'
      }
    }
  }

Template helper

Template.home.helpers({
  doc: {phones: ['09988765', '0998776']} // this should come from db.findOne
})

In template:

{{#autoForm id='test' schema="Schema.Array" type="update" doc=doc}}
  {{> afQuickField name="phones" value=doc.phones}}
{{/autoForm}}

I'm having this: arrayField

I've the following package dependencies:

meteor-platform
standard-app-packages
iron:router
iron:layout
aldeed:collection2
aldeed:simple-schema
aldeed:autoform
nemo64:bootstrap
less
accounts-base
accounts-password

Upvotes: 1

Related Questions