react-native-gifted-form icon indicating copy to clipboard operation
react-native-gifted-form copied to clipboard

How do you populate a form?

Open davidlivingrooms opened this issue 9 years ago • 5 comments

Great form library. I was wondering how you go about populating the form with initial values? Say that I want to use the form as an "edit" form. I don't see a clear way to populate the form with initial values. Thanks for the help!

davidlivingrooms avatar Jan 21 '16 03:01 davidlivingrooms

Hello, you can use the defaults prop

defaults={{
  username: 'Farid',
  'gender{M}': true,
  password: 'abcdefg',
  country: 'FR',
  birthday: new Date(((new Date()).getFullYear() - 18)+''),
}}

FaridSafi avatar Jan 21 '16 07:01 FaridSafi

Ah yes I see that now. Awesome, thanks again.

davidlivingrooms avatar Jan 21 '16 14:01 davidlivingrooms

You are welcome. I keep this issue open to help people to find this information until I improve docs

FaridSafi avatar Jan 21 '16 14:01 FaridSafi

@FaridSafi -> It is possible to fetch a rest api and a populate a form?

defaults={{ username: api.name, }}

...

?

andrebassi avatar Jan 19 '17 03:01 andrebassi

I have the same doubt @andrebassi and @FaridSafi.

Form is not populating while using rest Api. Only it populate based on the initial value.

Que : How to populate the form using REST Api?

dev-vinoth avatar May 25 '17 04:05 dev-vinoth