Как получить данные из формы

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
        caption="msg://caption"
        messagesPack="com.company.smssender.web.screens">
    <layout>
        <form id="inputForm">
            <textField
                    id="phoneTextField" caption="&#1053;&#1086;&#1084;&#1077;&#1088; &#1090;&#1077;&#1083;&#1077;&#1092;&#1086;&#1085;&#1072;"
                    align="BOTTOM_LEFT"/>
            <textArea id="messageTextArea" caption="&#1057;&#1086;&#1086;&#1073;&#1097;&#1077;&#1085;&#1080;&#1077;"
                      align="MIDDLE_LEFT"/>
            <textArea id="senderTextArea"
                          caption="&#1048;&#1085;&#1092;&#1086;&#1088;&#1084;&#1072;&#1094;&#1080;&#1103; &#1086;&#1073; &#1086;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1077;&#1083;&#1077;"/>
            <button id="sendButton" caption="&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1080;&#1090;&#1100;"
            />
        </form>
        <label id="responseLabel"/>
    </layout>
</window>
public class NewMessage extends Screen {
    @Subscribe("sendButton")
    public void onSendButtonClick(Button.ClickEvent event) {
        String phone = getScreenData().getContainer("phoneTextField");
        String message = getScreenData().getContainer("messageTextArea");
    }
}

У меня нет модели или подключения к бд. Как мне получить данные из формы по нажатию на кнопку?

Если работаем чисто с элементами управления на форме, то примерно так:

@Inject
    private TextField<String> phoneTextField;
...
....
String phone = phoneTextField.getValue();
error: modifier private not allowed here
        private TextField<String> phoneTextField;
error: annotation type not applicable to this kind of declaration
        @Inject

может есть часть документации, где это подробно расписано? пока плохо ориентируюсь в cuba platform

Скорее у вас структура кода в контроллере экрана неправильная.
Посмотрите этот пример.
Там не TextField, а PasswordField, но на этом отличия заканчиваются.

1 симпатия

Спасибо