Automatically insert characters from user

how do when i type usertxt = user.login and it populates the fields Name , email,…

@Subscribe("usertxt")
    protected void onUsertxtValueChange(HasValue.ValueChangeEvent<String> event) {
        String nametxt = event.getValue();
        User user = null;
        if(user != null){
            nameungvienField.setValue(user);
        }
    }

If you need the event to be fired faster than the fields loses focus, you may try setTextChangeEventMode() method.

See documentation: TextField - CUBA Platform. Developer’s Manual

The TextChangeEventMode defines the way the changes are transmitted to the server to cause a server-side event. There are 3 predefined event modes:

  • LAZY (default) - an event is triggered when there is a pause in editing the text.

no i want my nametxt to be able to receive data from sql

Then you have to:

  1. Create Middleware service
  2. Implement some method. Call JPQL or Native SQL query in this service.
  3. Inject service to the screen controller
  4. Call that method to get loaded data, where necessary.

See:
https://www.jmix.io/cuba-platform/guides/create-business-logic-in-cuba
https://doc.cuba-platform.com/manual-7.2/nativeQuery.html

1 Like

thank