Class FormModule
java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.core.Module
io.mindspice.simplypages.modules.FormModule
- All Implemented Interfaces:
Component
Module wrapper for composing and rendering a
Form.
Contract: when withSubmitUrl(String) is set, it is applied as hx-post on
the wrapped form during build.
Mutability and thread-safety: mutable and not thread-safe. Form fields are accumulated on this instance; mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.
-
Field Summary
Fields inherited from class HtmlTag
attributes, children, id, innerText, innerTextSlot, selfClosing, tagName, trustedHtml -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends a labeled field to the wrapped form.protected voidComposes module structure.static FormModulecreate()Creates a new module instance.withDescription(String description) Sets optional descriptive text rendered above the form.Replaces the wrapped form component.withModuleId(String moduleId) Sets module id and synchronizes the underlyingidattribute.withSubmitUrl(String url) Sets an application-controlled or separately endpoint-validated submit URL, applied as hx-post during build.Sets optional title consumed byModule.buildContent()implementations.Methods inherited from class Module
build, getModuleId, getTitle, invalidateContent, rebuildContent, render, render, withClass, withMaxWidth, withMinWidth, withWidthMethods inherited from class HtmlTag
addClass, addStyle, addTrustedStyle, getChildrenStream, getId, hxDelete, hxGet, hxInclude, hxPatch, hxPost, hxPushUrl, hxPut, hxScrollTargetTop, hxSwap, hxTarget, hxTrigger, withAttribute, withChild, withId, withInnerText, withInnerText, withUnsafeHtml
-
Constructor Details
-
FormModule
public FormModule()Creates a module with an empty form.
-
-
Method Details
-
create
Creates a new module instance. -
withSubmitUrl
Sets an application-controlled or separately endpoint-validated submit URL, applied as hx-post during build. Encoding is not scheme/destination validation, authorization, or CSRF. -
withDescription
Sets optional descriptive text rendered above the form. -
addField
Appends a labeled field to the wrapped form. -
withForm
Replaces the wrapped form component. -
withTitle
Description copied from class:ModuleSets optional title consumed byModule.buildContent()implementations. -
withModuleId
Description copied from class:ModuleSets module id and synchronizes the underlyingidattribute.- Overrides:
withModuleIdin classModule
-
buildContent
protected void buildContent()Description copied from class:ModuleComposes module structure.Called at most once by
Module.build()unlessModule.rebuildContent()is invoked. Do not rely on this method for per-request mutation.- Specified by:
buildContentin classModule
-