Gurjeet Singh
Gurjeet Singh

Reputation: 39

How to pre set data in reactjs-form-builder field?

I am using reactjs-form-builder for generating forms in react js my fields object is

this.state = {
            id: null,
            loading: true,
            fields: {
                "fields": {
                    "name": {
                        'label': "Product Name",
                        "type": "text",
                        "required": true,
                        "placeholder": true,
                    }
                    "submit": {
                        "type": "submit",
                        "label": "Edit Product",
                        "color": "btn-primary",
                    }
                }
            }
        };

How do i set value to field name.

Upvotes: 1

Views: 283

Answers (1)

Arashdeep Singh
Arashdeep Singh

Reputation: 320

Just add value in you field object.

"name": {
   'label': "Product Name",
   "type": "text",
   "required": true,
   "placeholder": true,
   "value": "You value here",
        }

Upvotes: 1

Related Questions