Nette Forms 3.3 introduces the `{form detached}` template tag to work around the HTML restriction that prevents nesting `<form>` elements. The solution leverages the HTML5 `form` attribute, which lets input and button elements reference a form by ID regardless of their position in the DOM. The outer form is marked `detached`, causing it to render as an empty `<form>` tag while its controls link back via the `form` attribute — freeing the inner form to render normally. The release also adds `{form scope}`, a unified replacement for the older `{formContext}` and `{formContainer}` tags, useful for rendering partial form sections or AJAX snippets without emitting a new `<form>` tag. The same underlying technique powers POST links for safe server-state-changing actions.

5m read timeFrom blog.nette.org
Post cover image
Table of contents
Why you can't put a form inside a formThe form attribute changes the rules{form detached} : nesting in one lineThe same principle powers POST links{form scope} : render just a piece of a formConclusion
8.1K Impressions