formio / ngFormBuilder

The Form.IO Form Builder Application
http://formio.github.io/ngFormBuilder/
MIT License
129 stars 130 forks source link

How to set a unique key for a custom component that doesn't change according to label? #441

Closed Morshed0308 closed 5 years ago

Morshed0308 commented 5 years ago

Hello I want the key property of JSON schema to be a unique key which doesn't change on label name ,How I can I do that?

For example

"components": [
        {
            "label": "Text Field",
            "allowMultipleMasks": false,
            "showWordCount": false,
            "showCharCount": false,
            "tableView": true,
            "alwaysEnabled": false,
            "type": "textfield",
            "input": true,
            **"key": "Mycustomkey",**
            "defaultValue": "",
}

I want to keep this key name no matter what I put on label name on this component.

@travist @randallknutson

randallknutson commented 5 years ago

In the newer versions of our form builder (in formio.js) the key is not modified for any existing components. It is only generated when the component is first added to the form. You may want to try updating to the latest beta version of ngFormio (which now includes the builder instead of being in a separate module) and see how it works.

Morshed0308 commented 5 years ago

Okay,thanks ! I will try that ! but in the old version is there any way I can set the key specific and it doesn't change on label name? @randallknutson

wag110894 commented 5 years ago

You can change the API key in the API tab of each component. It is labeled "Property Name". This will not change the label name of the component.

Hope this helps.

Thanks.