gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

Set option for all fields in struct #402

Open DanKurf opened 6 years ago

DanKurf commented 6 years ago

Version

Expected behaviour

I have a struct like this:

t.struct({
        rank1:AssessmentTypes,
        rank2:AssessmentTypes,
        rank3:AssessmentTypes,
        rank4:AssessmentTypes,
        rank5:AssessmentTypes,
        rank6:AssessmentTypes,
        rank7:AssessmentTypes,
        career: t.Number,
        personalityAndHobbies: t.Number,
        health: t.Number,
        relationship:t.Number,
        financial:t.Number,
        placeAndEnvironment:t.Number,
        spirituality:t.maybe(t.Number)
      })

I would like to be able to pass 'auto:"placeholders"' to all of these fields, i.e.

options:{
        fields: {
auto:'placeholders'
                  }
                       }

Actual behaviour

Instead, the only way I can get it to work is by passing to each individual field within the struct, i.e.

options:{
        fields: {
        rank1:{
            label: 'Rank the 7 Areas in terms of the order of importance you gave them over the past 5 years.\nRank 1:'
            auto:'placeholders'
        },
        rank2:{
          auto:'placeholders'
        }
}
}

Please advise, thanks.