In editor - example of how to use explode/implode formatters for a checkbox?

In editor - example of how to use explode/implode formatters for a checkbox?

mikducmikduc Posts: 25Questions: 7Answers: 0

I need to format a one character database text field (Y/N) to a client checkbox. Any examples of the editor formatters?

Ready to use formatters

The Editor libraries provider a number of method that are ready to use to perform formatting on the Field class instances. These methods are available as static members of the Format class. Each method returns a function of the type required by the Field formatter methods.

Arrays
- explode( delimiter ) - Convert an array of values from a checkbox into a string which can be used to store in a text field in a database. - Option: The delimiter to use - default value: |.

  • implode( delimiter ) - Convert a string of values into an array for use with checkboxes. - Option: The delimiter to use - default value: |.

Replies

  • rf1234rf1234 Posts: 2,806Questions: 85Answers: 406

    Javascript, field definition:

         {
                label: 'Your label',
                name: "YourBooleanVar",
                type: "checkbox",
                options: [
                    {label: 'yes', value: 'Y'},
                ],
                separator: '',
                unselectedValue: 'N'
            }
    

    you don't need an additional formatter for this.

This discussion has been closed.