I am attempting to update the value of a @jashkenas/inputs text form using a value derived from a click event in a Leaflet map. The idea here is that a user could either provide the coordinates manually or from clicking on a map.
I am able to get the value I need from the click event, but I am having trouble passing it into the text form. The text form value is apparently a constant. As such it appear I cannot just assign the value from the click event to the variable containing the initial text form value. Iāve included a basic example of what Iāve been trying to. Does anyone have any suggestions for how I can pass the value from a click event into a @jashkenas/inputs text form?
(I think I learned this trick from the Linked Inputs example.)
The āassigning to a constantā error occurs because Observable cells are in strict mode, and inside the cell newCoordinates hasnāt been defined yet. You donāt actually need a new view cell for what youāre trying to do, so I just placed the code defining the event handler directly inside the map cell.
Thereās also a fancier technique in Synchronized Views that Iāve also used from time-to-time.
This is great. There are a few concepts I think I need to dig into a bit more, but this approach on the whole makes sense. Thanks for the suggestions and explanation!