Just found your other post - linking here so other people see the context for future reference: Get information from database
Ok so it sounds like you want these things to happen in the frontend UI while you are in the process of editing a log?
In that case, the approach I suggested above will not work, because that happens server-side after the “Save” button is clicked.
In order to do things like this client-side you will need JavaScript (and also maybe some Drupal Form API Ajax). This is definitely “advanced” customization - but it sounds like a really cool feature idea!
Here are some resources that might help:
- The farmOS-map library is what powers the maps in farmOS, and it has a concept of “behaviors” that can be attached to a map to add custom JS functionality: GitHub - farmOS/farmOS-map: farmOS Map is an OpenLayers map designed for farmOS and farmOS Field Kit. It can be used in any project that has similar requirements.
- You might want to study how the “Bed Generator” module works, because it uses a farmOS-map behavior along with Drupal Form API: farmOS/modules/farm/farm_area/farm_area_generate at 7.x-1.x · farmOS/farmOS · GitHub
Hope that helps!