1

I am trying to add a custom text block. But when i enter any text in the input field, the error comes up. "Uncaught TypeError: Cannot read property 'call' of undefined"

Blockly.Blocks['text_input']={
init:function()
 {
 this.appendDummyInput()
 .appendField('Text Input:')
 .appendField(new Blockly.FieldTextInput(''),'INPUT');   
 this.setColour(170);
 this.setOutput(true);    
 }  
};
Anm
  • 3,291
  • 2
  • 29
  • 40
Priya
  • 13
  • 5

1 Answers1

0

this happens when the language definition for your custom type is missing.

// Replace "JavaScript" with the language you use.
Blockly.JavaScript['text_input'] = function(block) {
  var value = Blockly.JSON.valueToCode(block, 'INPUT', Blockly.JavaScript.ORDER_NONE);

  // do something useful here
  var code = 'var x= "bananas"';
  return code;
};
dube
  • 4,898
  • 2
  • 23
  • 41