Button click on Seesaw (Clojure) not getting new variable values

97 Views Asked by At

Having a problem with seesaw where i'm trying to let the user select the date using combo boxes and then call the function on a button click:

(listen load-data-btn :action (load-data 
   (selection year-cmb) (selection month-cmb) (selection day-cmb)))

This works however, the action loads when the program initially runs so whenever the button is clicked it always contains the first value the combo box is selected. So when I click the button it doesn't look for a new value in (selection year-cmb) it just keeps the one it's already got, the default is set to "".

Any idea how I make it so that every time I click the button call it will get the new value inside the combo box?

1

There are 1 best solutions below

0
broliverparker On

my problem was that I hadn't encapsulated the value in an (fn [e]) statement like below

    (listen load-data-btn :action (fn [e] 
(load-data (selection year-cmb) (selection month-cmb) (selection day-cmb))))