Techniques for Numbering Nested Forms in Phoenix LiveView

15
clicks
Techniques for Numbering Nested Forms in Phoenix LiveView

Source: arrowsmithlabs.com

Type: Post

The content explains how to implement numbering for nested forms in Phoenix LiveView, using a recipe creation/editing form as an example. It highlights the challenge of numbering ingredients using <.inputs_for /> and showcases how to leverage the index attribute from the ingredient_f variable to display a user-friendly incrementing number. The author addresses a bug where numbers may become misordered after rearranging inputs and provides a solution to ensure LiveView updates correctly after drag-and-drop actions using Sortable.js. The article serves as a practical guide for developers looking to enhance their forms in Phoenix LiveView.

© HashMerge 2025