Last active
June 25, 2017 08:07
-
-
Save martinyung/99c3159599e4264285300aeff59bd0c1 to your computer and use it in GitHub Desktop.
conversational-form with react.js - add cf info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hello extends Component { | |
... | |
componentDidMount(){ | |
// customize your questions here | |
this.refs.name.setAttribute('cf-questions', "What is your name?"); | |
this.refs.email.setAttribute('cf-questions', "What is your email?"); | |
this.refs.description.setAttribute('cf-questions', "Describe your requirement"); | |
this.cf = window.cf.ConversationalForm.startTheConversation({ | |
formEl: this.refs.form, | |
context: document.getElementById("cf-context"), // <-- bind this to an element instead of html body | |
flowStepCallback: (dto, success, error) => { | |
success(); | |
}, | |
submitCallback: () => { | |
// action when form submitted | |
console.log("Form submitted..."); | |
} | |
}); | |
} | |
render() { | |
... | |
} | |
} | |
export default Hello; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment