1

I have a custom form in my vulcan project, something like this:

  <form onSubmit={this.createBook}>
     <Components.FormItem label="Subject">
       <Components.FormControl
          type="text"
          value={this.state.subject}
          onChange={this.handleSubjectChange}
       />
       </Components.FormItem>
         <Components.FormItem label="To">
           <Components.FormControl type="text" />
         </Components.FormItem>
         <Components.Button type="submit">Create</Components.Button>
  </form>

Do u know how can in submit event "createChannel" write something like this for save the inputs in MongoDb?. I have tried but i get the error "this.props.createBook is not a function"

createBook = (e) => {
e.preventDefault(); // prevents page reloading

const database = 'mongo';
let res = Connectors[database].create(Books, { subject: 'anything'});
}

Thanks.

Sommer
  • 1,328
  • 2
  • 10
  • 20

0 Answers0