bietkul / react-native-form-builder

Handle your forms in a smart way
MIT License
121 stars 68 forks source link

Trigger validation on button clcik #23

Open DalbirKaur opened 5 years ago

DalbirKaur commented 5 years ago

I am unable to show validation message on button click. Kindly let me know how can I achieve this.

Q8hma commented 5 years ago

this code will work


  // Returns the values of the fields and auto Validate
  getValuesValidate() {
    const values = {};
    Object.keys(this.state.fields).forEach((fieldName) => {
      const field = this.state.fields[fieldName];
      if (field) {
        values[field.name] = field.value;
      }
      this.onValueChange(field.name,field.value);
    });
    return values;
  }