I have the following code. I succeed at setting the address, but I fail to get the value of the 'arena_name' input. I have searched through the documentation and I fail to find a way to understand how I can retrieve the value either via the path, I also could find how to retrieve it on basis of the 'id attribute'. I'm sure there is a way, please help me out! 🙏
fn place_name_updater() -> element.Element(Msg) {
let handle_click = fn(event) {
let arena_name_path = ["target", "previousElementSibling", "previousElementSibling", "previousElementSibling", "value"]
io.debug(arena_name_path)
let arena_name_result = event
|> decipher.at(arena_name_path, dynamic.string)
case arena_name_result {
Ok(arena_name) -> io.debug("arena name: " <> arena_name)
Error(_) -> io.debug("error, failed to get the arena name")
}
let arena_address_path = ["target", "previousElementSibling", "value"]
event
|> decipher.at(arena_address_path, dynamic.string)
|> result.map(UserSubmittedPlaceForm)
}
html.div([], [
html.form([],[
html.label([], [element.text("Arena name:")]),
html.input([attribute.id("arena_name")]),
html.label([], [element.text("Arena address:")]),
html.input([attribute.id("arena_address")]),]),
html.button([event.on("click", handle_click)], [html.text("Submit")]),
])
}