Skip to content
Discussion options

You must be logged in to vote

I don't know how your form is built but my guess is to have two different form. One for the edit with all fields and another for the delete.
You can add an hidden field on each form that content a type of form. For exemple

<form>
  <input type="hidden" name="type" value="edit" />
  ...
</form>

<form>
  <input type="hidden" name="type" value="delete" />
  ...
</form>

Now, when transition.submission is defined you have access to formData from transition?.submission?.formData.get("type").

Exemple:

const isDeleting = transition?.submission?.formData.get("type") === "delete";
const isSaving = transition?.submission?.formData.get("type") === "edit";

...

<button>
    {isSaving ? "Saving..." …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@runoncedev
Comment options

@kiliman
Comment options

Answer selected by Adam-Collier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants