Extension bug? data picker doensn't show up

I think I’m going crazy. Making a quick nodejs server extension… I just need 2 inputs:

pattern and length

This is in my .hsjon:

{ 
            name: 'pattern', 
            optionName: 'pattern', 
            title: 'Pattern input',
            type: 'text', 
            required: true,
            defaultValue: 'Aaaa' 
            help: 'The pattern to use for randomizing', 
            serverDataBindings: true
        },
        {
            name: 'length',
            optionName: 'length',
            title: 'Length input',
            type: 'number',
            required: false,
            serverDatabindings: true
        }

This doesn’t show the databinding picker for the ‘pattern’ field… although I swear this code works for another extension of mine.
image

What on earth is going on?

Yes I’ve tried restarting wappler several times.

full hjson code:

{
  type: 'randomatic',
  module : 'randomatic',
  action : 'randomatic',
  groupTitle : 'Custom Actions',
  groupIcon : 'fas fa-lg fa-database comp-data',
  title : 'Create random string @@var(actionName)@@',
  icon : 'fas fa-lg fa-book',
  dataPick: true,
  dataPickObject: true,
  properties : [
    {
      group: 'Randomatic properties',
      variables: [
        { 
            name: 'name', 
            optionName: 'name', 
            title: 'Name', 
            type: 'text', 
            required: true, 
            defaultValue: 'randomize'
        },
        { 
            name: 'pattern', 
            optionName: 'pattern', 
            title: 'Pattern input',
            type: 'text', 
            required: true,
            defaultValue: 'Aaaa' 
            help: 'The pattern to use for randomizing', 
            serverDataBindings: true
        },
        {
            name: 'length',
            optionName: 'length',
            title: 'Length input',
            type: 'number',
            required: false,
            serverDatabindings: true
        }
      ]
    }
  ]
}

full extension js codE:

const readingTime = require('reading-time');
exports.readingtime = function (options) {

    // Parse the 'text input' - if nothing is used, set to 'null'
    let text = this.parseOptional(options.inputText, '*', null);
    console.log(text);
    let wordsPerMinuteInput = this.parseOptional(options.wordsPerMinute, 'number', null);
    let readingTimeOptions = {
        wordsPerMinute: wordsPerMinuteInput
    }
    const stats = readingTime(text, readingTimeOptions);
    console.log(stats);
    return stats
};

PS The ‘defaultvalue’ of ‘name’ also never showed up in any of my custom extensions.

I think its because the field type is NUMBER.
Also, avoid using keywords like ‘length’ as the name of the input. Use input_length instead.

2 Likes