#How to get text from input form?

1 messages · Page 1 of 1 (latest)

spare urchin
#

How do I get the text from this input form?

    rsx!(
        form {
            class: "h-screen flex flex-col items-center justify-center  text-center",
            onsubmit: move |event| dioxus_logger::tracing::info!("SUBMIT: {:?}", event.values()),
            input {
                // value: "{input}",
                // // onsubmit: move |event| dioxus_logger::tracing::info!("SUBMIT: {:?}", event.value()),
                // oninput: move |ev| input.set(ev.value()),
                r#type: "text",
                placeholder: "Enter your joke",
                class: "input input-bordered input-primary w-full max-w-xs"
            }
            br { class: "h-5" }
            input { r#type: "submit", class: "btn btn-primary btn-outline" }
        }
    )
tranquil anchor
#

If you add a name to your input, with e.g. input { name: "joke" }, you can access it from that call to event.values() with something like event.values()["joke"]

spare urchin
#

Thank you very much!