Genie Discord forum

Author Avataryakir12
10/3/2023, 10:26:44 AM

I'm trying to build a dynamic set of radio buttons. I want to have a set of radio buttons where only one can be chosen at a time, but also be able to update that set, and track when one button is chosen.

The following fails:

module App
using GenieFramework

@genietools

@app begin
    @in options = ["opt1", "opt2", "opt3"]
    @in chosen = "opt1"
    @onchange chosen begin
        println(chosen)
    end
end

function ui()
    row(@recur("opt in options"), [radio(:opt, :chosen, val = :opt)])
end
@page("/", ui)
end

because radio requires a String, not a Symbol, as its label.

Author Avataryakir12
10/3/2023, 12:20:15 PM

solved just set label to :opt:

row(@recur("opt in options"), [radio("tmp", :chosen, val = :opt, label=:opt)])