
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
dynamic_nested
Advanced tools
Add/Remove nested associations dynamically in forms that generates markup like Phoenix Framework.
Add dynamic support to add and remove nested associations generated by Phoenix.HTML.inputs_for
.
In order to get it working, the following attributes must be added in the markup:
[dynamic-nested] - to active this component.
[dynamic-nested-index=${index}] - to get nested association.
[dynamic-nested-add] - to add nested.
[dynamic-nested-remove] - to remove nested.
<div dynamic-nested>
<%= inputs_for @f, :categories, [skip_hidden: true], fn c -> %>
<%= content_tag :div, dynamic_nested_index: c.index do %>
# PS: generate hidden fields inside rows group to handle them easily.
= for {key, value} <- row.hidden do
= hidden_input c, key, value: value, dynamic_nested_field_id: true
<%= text_input c, :name %>
<button type="button" dynamic-nested-remove>Remove</button>
<% end %>
<% end %>
</div>
<button type="button" dynamic-nested-add>Add</button>
Also, make sure to initialize this script after importing it on your application.
import DynamicNested from 'dynamic_nested'
document.querySelectorAll('[dynamic-nested]').forEach(element => DynamicNested(element))
It supports the following callbacks:
const beforeClone = (element) => { ... }
const afterAdd = (element, newElement) => { ... }
const afterRemove = (elements) => { ... }
document
.querySelectorAll('[dynamic-nested]')
.forEach(element => DynamicNested(element, { beforeClone, afterAdd, afterRemove }))
Everytime a User adds a new row, it is going to generate a new index for that row incrementing +1 from the last row on the page. As soon as an User removes a row, all indexes will be updated accordingly to reflect their position on the page.
npm install --save dynamic_nested
DinamicNested
will
use it as a template to clone.Phoenix.HTML
that supports skip_hidden
fields.FAQs
Add/Remove nested associations dynamically in forms that generates markup like Phoenix Framework.
We found that dynamic_nested demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.