-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API example #62
Comments
Just some clarity on this. I am doing this for a charity program where people can donate clothing, new and old. So I can give more detail if you are able to assist. |
Hi there @turbocpt , To give you more clarity on this: view the plugin (and the conversation) as a state machine. Every state expects some input and tells which is the new state based on the input. When the plugins builds the conversation from a form, it builds the states and transition between states as a linked list of objects, and is predetermined from the start. To use it expecting responses from an API, you have to build the states dynamically. The example at https://github.com/eduardotkoller/convForm/blob/master/api_example.html (the function at line 40) can give you a hint on how to do that. Use the input from the user to send the request for the API, use response from the API to build a new state and link the current state to it, and call the I can't really help you more than that, the last time I used jQuery was when I created this (sorry). |
Another way of doing this is passing the logic to the templating engine. If your "conversation" is kinda fixed (based on a json file that shouldn't change while the user is using the form), you can make a call for the API to get the json file, build the conversation using HTML and initialize the plugin after. |
@eduardotkoller Thank you very much for the reply. I am clueless when it comes to jquery, but I will try and make sense of how to do this. |
Hi, I am aware that you are no longer maintaining this. but firstly, let me say thanks for this. it is a real nice form.
I however just need some guidance on how to create the API calls. I will be using a file on the local system to test this, so is there a specific format and method used to use the data? Is it json specific? I would really appreciate your assistance. I have not worked with jquery as yet and not sure how to go about this.
So my intension is to do the following. The form will have an initial question with 2 options as buttons.
from there, the buttons will get results from the json file. The json results will then become the new dynamic buttons, with very little user test input. For instance:
The only question that will be on the form will be:
Choose option: new | old
from there, the questions and buttons should be loaded from the API call.
So all of the remaining questions and answer buttons will then be from the API json file.
The text was updated successfully, but these errors were encountered: