Skip to content

Morphing: impossible to "clear" a form due to ignoreActiveValue: true #1194

@weaverryan

Description

@weaverryan

Hi there!

In #1141, Idiomorph was changed to use ignoreActiveValue: true. That maybe makes sense... but it prevents a form from being reset/cleared.

For example, in the following form, after submitting, the page redirects to the same URL, but with an empty form. The behavior varies based on whether an input is active or not. In the video:

  1. Submit 1 (:00-:04) hitting enter while inside the <input> results in that field NOT being cleared (wrong behavior).
  2. Submit 2 (:05-:10) clicking the submit button makes it the activeElement and then all fields are cleared.
turbo-form-reset.mp4

I'm not sure how to handle this. In #1141, @seanpdoyle added ignoreActiveValue: true to support things like auto-submitting forms while typing into an input. What's not clear in that example is this: was ignoreActiveValue: true added to preserve the value of the input or something with its active state? To ask differently: did the submitted form HTML used for morphing in that example contain the updated value="another search term" attribute value on the <input type="search">? If not, perhaps it should have... and the example was flawed (i.e. if the new <input type="search"> does not have a value, then the value should be cleared)? If yes, was ignoreActiveValue: true done to preserve some sort of focus or active state problem?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions