Question T13408
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Page Selector not available for running tasks

Custom property not visible on designer

created 2 years ago

Hi there,

We recently added a new custom property called "Format" for the questions of type "text". This new property is similar to the "inputType" property.

The new property we created is shown correctly on the sidebar, but we would like to have it also rendered on the designer. We were able to remove the inputType property from the designer, but we couldn't add the new custom property to the designer.

The new property has also multiple options, similar to the inputType property. Is there a way to render it (new property is on green on the image) on the designer where currently inputType is rendered (red in the image)? Or maybe a way to replace the behavior of the inputType property (replace choices / onSetValue / onSettingValue/ etc)?

image (1).png

Thanks

Comments (2)

    Hello Luan,
    Thank you for contacting us. If you wish to render a custom property on a survey element on a design surface, you can add a custom adorder action. Please follow this demo for further details: Create Custom Adorners.

    Please let me know if you have any questions or require further assistance.

      Thank you Jane. But I need to be able to have an "adorner" that works like a dropdown, like on the inputType property. On the example is just a simple button.

      How would I change it to be a dropdown and add options to it? The documentation of the onDefineElementMenuItems does not contain many details

      Answers approved by surveyjs Support

      created 2 years ago

      Hello Luan,
      Thank you for the update. You can implement a drop-down adorner action using the createDropdownActionModel function from the survey-core module. The following code snippet demonstrates how we create a Convert To drop-down action in a Survey Creator: https://github.com/surveyjs/survey-creator/blob/ef997721846b21f71a4f83eeac6ad445f43a2d30/packages/survey-creator-core/src/components/question.ts#LL290C23-L290C48.

      JavaScript
      import { createDropdownActionModel } from "survey-core"; ... creator.onDefineElementMenuItems.add((sender, options) => { let customDropdownAction = createDropdownActionModel( { id: "customDropdownAction", css: "sv-action--convertTo sv-action-bar-item--secondary", title: "My Action", visible: true }, { items: myActions, allowSelection: true, selectedItem: myActions[0], onSelectionChanged: (item) => { alert(item.data.name); }, verticalPosition: "top", horizontalPosition: "center" } ); options.items.push(customDropdownAction); });

      View Demo

      Clipboard-File-1.png

      Please let me know if you have additional 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.