Question T14920
Visible to All Users

Custom question in form viewer problem

created a year ago

I should add a custom question in the form viewer, but I can't, if I add it directly in the JSON it doesn't appear. I use V1 of the component as I still have the old Angular, how can I display a custom question?

Show previous comments (4)

    Jane, sorry, but what I'm trying to tell you is that from your documentation I'm not understanding how to register the component in the form library. In the creator it is clear, but I can't find any example of code that populates a form, only examples of creators.

      Hello,
      You would use the same code to register custom components in a Form Library and Survey Creator. Do you have access to the code which you used to register a custom esito component?

        TypeScript
        ComponentCollection.Instance.add({ // A unique name; must use lowercase name: "fullname", // A display name used in the Toolbox title: "Full Name", // An array of JSON schemas that configure the nested questions elementsJSON: [ { type: "text", name: "firstName", title: "First Name", isRequired: true }, { type: "text", name: "lastName", title: "Last Name", isRequired: true, startWithNewLine: false } ] });

        I used this method, i use this method also in the form library?

        Answers approved by surveyjs Support

        created a year ago (modified a year ago)

        Hello,
        Yes, you can use this function to register a custom component in a form library. Import ComponentCollection from "survey-angular" and register your custom component within a SurveyJS library:

        JavaScript
        import { ComponentCollection } from "survey-angular"; ComponentCollection.Instance.add({ // A unique name; must use lowercase name: "fullname", // A display name used in the Toolbox title: "Full Name", // An array of JSON schemas that configure the nested questions elementsJSON: [ { type: "text", name: "firstName", title: "First Name", isRequired: true }, { type: "text", name: "lastName", title: "Last Name", isRequired: true, startWithNewLine: false } ] });

        I also attached a demo for your reference.

        Hope this helps. Please let me know if you have further questions.

        Thanks

        P.S. We hope you enjoyed the level of service you received. If so, we would love if you could leave your feedback on SurveyJS page at g2.com. As we’re building our business, every review helps build credibility for future customers and your feedback would be greatly appreciated.

          Comments (2)

            Thank u Jane, this solve my problem!! Thank u very much!!

            Yes i leave a good feedback for u!

              Thank you! You're very welcome. Please feel free to contact us if you have any further questions.