formio / react

JSON powered forms for React.js

Home Page:https://form.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I make reference to <Form /> from external javascript code ?

ansonchau2007 opened this issue · comments

I have an external button which will call API to populate values to formio fields

const prefillHandler = () => {
    // call API an get result
    // form.getComponent('firstName').setValue(result);
  };
...
<Button onClick={prefillHandler} >Prefill</Button>
<Form
              src={"https://examples.form.io/example"}
              onSubmit={onSubmitHandler} 
 />

How can I do to make reference to the form in my function prefillHandler ?

Thank you

This has been solved. Issue closed