Skip to content

initial_value sets initial_value attribute #5491

@Alxandr

Description

@Alxandr

Problem

I'm trying to set the initial value of an imput field. Instead, I end up with a initial_value attribute on the input element.

Steps To Reproduce

The code I'm using to get the initial value looks like this:

	let initial_pin_response = use_server_future(|| api::initial_pin())?;

	let initial_pin = initial_pin_response.read();
	let initial_pin = initial_pin.as_ref().unwrap().as_deref().unwrap_or_default();

    rsx! {
    				    input {
							r#type: "text",
							autofocus: "autofocus",
							name: "pin",
							initial_value: initial_pin,
							required: true,
						}
    }

// in the api crate:
#[server]
pub async fn initial_pin() -> Result<String, ServerFnError> {
	Ok("lol".into())
}

Expected behavior

The input should be created with the initial pin as a value.

Screenshots

Image

Environment:

  • Dioxus version: v0.17.5
  • Rust version: 1.94.1
  • OS info: NixOS Unstable
  • App platform: web

Questionnaire

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions