space10-community / conversational-form

Turning web forms into conversations
https://space10-community.github.io/conversational-form/
MIT License
3.8k stars 771 forks source link

Question based on previous response #18

Closed cauesanches closed 7 years ago

cauesanches commented 8 years ago

Hi,

Firstly, congratulations for iniciative. Conversational form is the future of web communication.

Well, I'm building a form that I need set a specific question according with the previous answer. For example:

Question: The client is a person or a company?

Question (if person): Inform the number of personal document. Question (if company): Inform the number of employees.

Has a solution for this case? Is it possible get the previous answer and make a test to show correct question?

Thanks!

felixknox commented 8 years ago

hi @cauesanches great feature. I see it implemented in a couple of ways:

  1. "100% control": We could expose the internal event system. This way you would be able to listen for when a user submits an answer and inject a new cf.ITag or setting focus on an already registered tag, depending on the answer.

  2. "Pure markup": We could setup a way to map an answer to a specific tag via markup.

    <input cf-answers="fruit=#list-of-favourite-fruits|vegetables=#list-of-favorite-veggies" ...>

    so a user writes "fruit" and submits, would show the