How to enter JavaScript code on a screen (Cuba Studio)?

Good Morning,

I need to create a very simple screen in Cuba studio which only has a TextArea and a Button. The intention is that the function that this Button must perform is written in JavaScript and I can not put that code in the “Controller” section of the screen.

Someone know how to I can do?

Thank you very much in advance,

You can wrap your JS logic in a custom component:

In that sample, instead of using the ready-made jQuery plugin, you’ll have to put your own JS code, and create the appropriate glueing between server-side code and client-side JS.
If you don’t need any data on the server, you can simply leave the generated java files empty, and put your code in the *-connector.js file. Remember that jQuery is already included, so you can use it in your JS code.


Good afternoon,

First of all, thanks for your response.
The second thing, what I’m really trying to implement is a Speech that transcribes what I say into text. So I only need a screen that contains a TextArea and a button, which when clicked, executes the action of the JavaScript code.

I have created the component and so on, but I do not know how to really implement it. Any more suggestions?

Thank you very much again,

This needs a bit more context:

Are you integrating this into an existing CUBA application?
If yes, presumably the text that will be “produced” by the speech recognition APIs, and placed into the input type=text control on the web page, should be also read by the server side code.

Otherwise, if you’re not going to use that text in any server-side code then… why CUBA? :wink:


Good Morning,

Sorry, but it’s complicated to explain. What I did was in a file.html put both the TextArea component and the button to start transcribing and below a small JavaScript code that is the one that performs the functionality. Well, that html launched on a local Tomcat works perfectly, but really the fact of transcribing what I need in the CUBA app that I will develop, that’s why I asked, because I do not finish understanding how to introduce this.

Thank you very much,


Can we talk about this theme in Google Hangouts or similar? I need support, If you want we can talk in other platform :slight_smile:

Thank you very much,

I’m sorry @jordi.gisbert.ponsoda, but what you’re asking is like 1-to-1 custom support, and this can’t be free…

The documentation page I linked before should be sufficient to accomplish your task, given that all you need is to synchronise a textarea contents, and the (working) example in that page is well explained.

My advices are:

  1. if you have enough past programming expertise, then you only need to invest more time in studying CUBA and the underlying technologies (in your case, especially Vaadin). I spent last year doing so, using my own (unpaid) time…
  2. if you’re in a hurry, and you’re doing this for a client/commercial project, invest an hour with CUBA personalised support: Jmix Store

Unfortunately I’m not (yet) ready to accept payments for remote consulting, so please refer to the official Haulmont consulting service.

Good luck for your project,