Closed Demitroi closed 7 years ago
can you share a largest code-snippet with the event implementation?
`var body *gowd.Element
func main() { body = bootstrap.NewContainer(false) sm := gowd.NewElementMap() div := gowd.NewElement("div") div.AddHTML(`
</select>`, sm)
sm["selecter"].OnEvent(gowd.OnChange, sltChanged)
body.AddElement(div)
gowd.Run(body)
}
func sltChanged(sender gowd.Element, event gowd.EventElement) { body.AddElement(gowd.NewText(event.GetValue())) body.AddElement(gowd.NewElement("br"))
}`
Check it out https://justpaste.it/18xel
That doesn't happen when the "sltChanged" is not called.
//sm["selecter"].OnEvent(gowd.OnChange, sltChanged)
Check it out https://justpaste.it/18xep
I want that an option stays selected as the second link.
looks like a bug
the problem was that <select>
was not considered as input
tag and therefore its event data was not processed.
The fix was both in go
and the js
code, here: https://github.com/dtylman/gowd/blob/master/cmd/template/main.js#L93
Make sure you update your javascript or use the new and fixed js
fro template.
I'm developing a GUI app on go
div = gowd.NewElement("div")
div.AddHTML(
i have 3 value in a select element, when the onchange event is called works and i can get de option... But when the event finishes, the option is changed to the first option.
How i can solve this issue?