Skip to content

Constrained color select in form component #275

Answered by lovasoa
matthewlarkin asked this question in Q&A
Discussion options

You must be logged in to vote

json functions (including json_array) in SQLite return strings, not native json objects... To create an array, you can select multiple columns with the same name:

  select
    'color' as type,
    'red' as colors,
    'green' as colors,
    'blue' as colors;

if you want to use json_array, you can parse the json from your template using the to_array helper. Here is an example from the shell component:

    {{#each (to_array javascript)}}
        {{#if this}}
            <script src="{{this}}" defer></script>
        {{/if}}
    {{/each}}

https://github.com/lovasoa/SQLpage/blob/main/sqlpage/templates/shell.handlebars#L22-L26

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@lovasoa
Comment options

@lovasoa
Comment options

@matthewlarkin
Comment options

@lovasoa
Comment options

Answer selected by matthewlarkin
@matthewlarkin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
custom components Related to custom user-created handlebar components
2 participants