I would like to append some user input to a list by using a Button
to submit it. The problem is that every change in the user input results in a new submission, regardless of whether the submit button has been clicked.
I think the general scheme would be something like this:
my_list = []
@bind some_input TextField()
@bind submit_button Button()
let submit_button
push!(my_list, some_input)
end
Iβve also tried to use a function like this but it did not solve the problem either:
function submit_function(b, input)
push!(my_list, input)
end
submit_function(submit_button , some_input)
In both cases, if the first input to be added is βhereβs stuffβ, the result in my_list
is:
["h", "he", "her", "here", "here's", "here's ", "here's s", ... , "here's stuff"]
β¦and so on. I also briefly explored using other html user interface tools but that appeared to have the same behavior.
For other cases Iβve done a workaround using a CheckBox
and executing based on whether checked or not, but this will become impractical for the current problem. Am I using Button
s incorrectly or is this an inherent limitation? Are there any alternatives to interactively adding user input to a list?
If it makes any difference, what I ultimately want to do is have the ability for a user to input multiple values using a mix of Select
, NumberField
, Slider
, TextField
which are all contained in a Type
. Then once all fields are complete, the user can submit, that type will be instantiated and pushed to the list, and the fields will return to default values.
Thanks in advance for advice!