Validate() with formattable object

leaflet
formattable
validate

#1

Hey!

So - before I go off and make a reprex for this (sorry!), I want to see if anyone has come across anything similar. I have a state chloropleth map built w/ leaflet and am triggering events by clicking on the state tiles to filter/display charts throughout my app - including a formattable table. However, I cannot get validate to properly sanitize the error message of my table when a state has not been clicked.

When I include validate(need(input$forecast_map_shape_click$id, "Please Make Selection")) (which should validate the pass of the shape click from my “forecast_map” leaflet visual to the table and return the message “Please Make Selection” if it fails the validation) it returns Error: invalid json string

I can make a reprex if it helps - but it would be a pretty bulky example for a single question haha.

Thanks in advance!


#2

Figured it out! Instead of validating against the shape_click$id, you have to validate against is.null(input$forecast_map_shape_click) to kick out the error message