Question T184
Visible to All Users

Database Structure

created 7 years ago (modified 7 years ago)

As per our database structure, we currently need following information for each answer item:

QuestionId="12"
AnswerTypeId="1"
AnserId="4"

-> Currently all fields above are used for each answer of question, but in SurveyJs, they store answer text in array for question with single value only. It looks like we can not add all the above infomration into the SurveyJS answer text. We need some way to store this much information in SurveyJS. Is there a way to create the three above within SurveyJS?

  1. SurveyJs does not provide Rich Text Editor Question and Answer Text. In our current database, many surveys use html content in QuestionText and AnswerText. How can we achieve this?

Thank you for your help!

Answers

created 7 years ago

Hello Eric,

  1. At first you have to add these properties into question, so we can serialze/deserialize them:
    Survey.JsonObject.metaData.addProperties("questionbase", ["QuestionId", "AnswerTypeId", "AnswerId"]);
    If you have, let's say 5 types id, you may use this code:
    Survey.JsonObject.metaData.addProperties("questionbase", ["QuestionId", {name: "AnswerTypeId", choices: ["1", "2", "3", "4", "5"]}, "AnswerId"]);

Please look at this demo for more information: https://surveyjs.io/Examples/Editor/?id=addproperties, there is a Documentation type.
Then you may add this properties into result. I've just answered the similar question: https://surveyjs.answerdesk.io/ticket/details/T185

  1. Rich Text Editor. What do you mean? Do you have a markdown editor in your survey app? You may create a custom widget. We are going to introduce new custom widget and plug-ins in several days: https://github.com/surveyjs/widgets. We may make an example with an markdown editor. Could you tell us, what do you use?

Thank you,
Andrew

    Show previous comments (2)
    EB EB
    Eric Bransteter 7 years ago

      Hello Andrew,

      We need CK Editor for question Title propery which found in propery editor popup for any question. i also atteched screenshot for this.

      Thank you for your help

      img_20171108.png

      img_20171108(1).png

        Hello Erik,
        You may use the CK Editor now. Please take a look at this issue: https://github.com/surveyjs/editor/issues/185
        I will make a demo later.

        You have to use a markdown library to render correctly html text. Here is the demo: https://surveyjs.io/Examples/Library/?id=survey-markdown-radiogroup

        Thank you,
        Andrew

        EB EB
        Eric Bransteter 7 years ago

          Hello Andrew,

          Thanks for your help,
          we can not use markdown editor, we need CK Editor for our site, so we are waiting for your demo.

          Thank you,