Countries Towns Enum

Hello,

I have two attributes (columns) in my Edit view:

Country - CountriesEnum type
Towns - TownsEnum type.

Now when I select a specific country I need a related list of towns.

if (countryField.getValue() == CountriesEnum.UK){
//townField.setValue(specific list);

}

How can I do this?
Another question: is there the generator attribute implemented in Cuba 7?
https://doc.cuba-platform.com/manual-6.7/gui_FieldGroup.html?_ga=2.87717406.703765926.1579164825-1873345578.1572356404#gui_FieldGroup_field_generator

Regards,
-n

Hello @neutrino

Now when I select a specific country I need a related list of towns.

I suggest you to create simple entities for countries and towns. Their association will be “one-to-many”. Then just load towns using simple query like this: select t from app_Town t where t.country = :country.

Another question: is there the generator attribute implemented in Cuba 7?

I suggest you to use the Form component, because FieldGroup is legacy now. The Form component allows you to use pluggable component factories. Please read our documentation for further information

Regards,
Daniil

1 Like