eduardotkoller/convForm

New Feature Enquiry

pravnyadv opened this issue · 1 comments

Hi, thanks for making this cool plugin
i have a question, suppose we are in middle of the conversation and we need to jump back to a certain question and resume the whole conversation from there, how can i build all the states from that point? i kinda want ability to jump to previous questions and start conversation from that point instead of starting from the very first question in the initial form. i tried something like this:
[suppose when user click Dashboard button in one of the answers (value = main) so in print answers i change the next state to this dashboard state ]

//get the index at which that question is present
var check = inputs.map(function(element) {
return element.name;
}).indexOf('main');

//build the first quesiton
var dashboard = new SingleConvState(inputs[check]);

//build its states ( but this is not working)
for(var i in inputs) {
// jumping to that index where dashboard question is present
i = check;
console.log("i is: "+i);
if(i != 0 && inputs.hasOwnProperty(i)){
dashboard.next = new SingleConvState(inputs[i]);
dashboard = dashboard.next;
}
}
//this prints the question i want to jump back to
console.log(dashboard);

you don't have to build this feature just if you can help me understand how to build all states from a certain point that would be awesome(I am kinda new in Web development), thanks in advance

Hello, sorry for the delay,

There is a specific example on the demo that does exactly that -- see lines 88-105 in the index.html.