Using Your Local R Environment to Deploy Blockspring Functions

Configure New Blockspring Form Input

In the last step, your function worked locally but errored on its Blockspring homepage. The fix is to add the color parameter, which we use in request$params$color, into our blockspring.json file.

{
  "title": "Best function ever",
  "description": "",
  "parameters": [
    {
      "type": "text",
      "label": "First Name",
      "name": "first_name",
      "help_text": "Enter your first name.",
      "default": "Paul"
    },
    {
      "type": "number",
      "label": "Age",
      "name": "age",
      "help_text": "Enter your age.",
      "default": 26
    },
    {
      "type": "color",
      "label": "My color",
      "name": "color",
      "help_text": "Enter your favorite color.",
      "default": "#a2b3c4"
    }
  ],
  "is_public": true,
  "language": "R"
}

Set the type as "color", set the label and help_text as arbitrary text to help the user understand what they need to input, and the name field to match our key in request$params. Visit the blockspring.json reference article to learn more about configurations.

Now you can push and open your function and you'll see a color-picker on your function's homepage.

$ blockspring push
Syncronizing script file ./block.R
Syncronizing config file ./blockspring.json
$ blockspring open

Choose a color with the color-picker, click submit, and you'll see your function working as it did locally.

Success