class

ActionView::Helpers::FormHelper::FormBuilder

Inherits Reference < Object

Constants

WEEKDAYS_FROM_MONDAY = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

Constructors

new(view : ActionView::Helpers, scope : String, model : FormModel | Nil = nil, emit_ids : Bool = false)
Source

Instance methods

button(content : String, **opts) : SafeString

Default caption uses I18n model names in Rails ("Update Post"); the port takes an explicit caption or a block.

Source
button
Source
check_box(attr : String | Symbol, *, checked_value : String = "1", unchecked_value : String = "0", include_hidden : Bool = true, checked : Bool | Nil = nil, **opts) : SafeString

Positional values as named args (Crystal has no positional options hash): check_box :role, checked_value: "administrator", unchecked_value: "member". include_hidden toggles the unchecked-value companion (Rails include_hidden); a hidden opt passes through to the input as a boolean attribute, as in Rails. checked: overrides the model-derived state (the port's FormValue has no enum coercion — same deviation as collection_check_boxes). Attribute order per oracle (fw_check_values*, fw_check_disabled): hidden (name, [disabled/form], type, value, autocomplete), then opts, type, value, checked, name, id.

Source
collection_check_boxes(attr : String | Symbol, collection : Array(FormOption), *, checked : Array(String) | Array(Int32) | Nil = nil, include_hidden : Bool = true, **html_opts) : SafeString

Hidden companion (type, name, value, autocomplete — hidden_field_tag with id nil) prepended, then checkbox + label per item with forced ids (Rails skip_default_ids = false). Checked values come from the checked: arg — FormValue has no array attributes (documented deviation from Rails' object[method] arrays).

Source
collection_radio_buttons(attr : String | Symbol, collection : Array(FormOption), **html_opts) : SafeString
Source
collection_select(attr : String | Symbol, collection : Array(FormOption), *, selected : FormOptionsHelper::SelectValue | Nil = nil, disabled : FormOptionsHelper::SelectValue | Nil = nil, include_blank : String | Bool | Nil = nil, prompt : String | Bool | Nil = nil, multiple : Bool = false, include_hidden : Bool = true, **html_opts) : SafeString
Source
color_field(attr : String | Symbol, **opts) : SafeString

Invalid colors default to #000000; the value attribute is emitted BEFORE type (oracle fw_typed_text).

Source
date_field(attr : String | Symbol, **opts) : SafeString
Source
datetime_field(attr : String | Symbol, **opts) : SafeString

Rails 8.1: datetime_field renders type="datetime-local".

Source
datetime_local_field(attr : String | Symbol, **opts) : SafeString
Source
email_field(attr : String | Symbol, **opts) : SafeString
Source
emitted_hidden_id?
Source
field_id(attr : String | Symbol) : String

Public field id (sanitized), emitted even in form_with contexts where field ids are skipped (oracle ff_field_id); for scope-less builders (form_with url:) the bare attr.

Source
field_name(attr : String | Symbol) : SafeString
Source
fields_for(assoc : String | Symbol, record : FormModel | Nil = nil, *, child_index : Int32 | String | Nil = nil, include_id : Bool = true, &) : String

fields_for — nested forms (oracle: ff_nested*, ff_child_index, ff_destroy cases). Nested-attributes naming user[posts_attributes][0][title] when the parent exposes the association through FormModel#form_nested_children, with a sequential per-association index and an automatic hidden id appended AFTER the block for persisted children (Rails: emit_hidden_id); otherwise plain scope nesting (user[comment][title]).

Source
file_field(attr : String | Symbol, **opts) : SafeString

Opts first, no value, flips the form's multipart flag.

Source
grouped_collection_select(attr : String | Symbol, groups : Array(GroupOption), *, selected : FormOptionsHelper::SelectValue | Nil = nil, include_blank : String | Bool | Nil = nil, prompt : String | Bool | Nil = nil, multiple : Bool = false, include_hidden : Bool = true, **html_opts) : SafeString
Source
hidden_field(attr : String | Symbol, **opts) : SafeString

Attribute order per oracle (ff_hidden_value, fw_fields): autocomplete, user opts (an explicit value: slots in here), type, value, name, id. load_defaults 8.2 apps drop the autocomplete via remove_hidden_field_autocomplete.

Source
label(attr : String | Symbol, text : String | Nil = nil, **opts) : SafeString
Source
label(attr : String | Symbol, **opts, &) : SafeString
Source
month_field(attr : String | Symbol, **opts) : SafeString
Source
multipart?

Set by file_field; form_with reads it after the block to emit enctype="multipart/form-data".

Source
number_field(attr : String | Symbol, **opts) : SafeString
Source
password_field(attr : String | Symbol, **opts) : SafeString

Rails PasswordField: the object's value is never echoed — value comes only from an explicit value: opt.

Source
radio_button(attr : String | Symbol, tag_value : String, **opts) : SafeString
Source
range_field(attr : String | Symbol, **opts) : SafeString
Source
search_field(attr : String | Symbol, **opts) : SafeString
Source
select(attr : String | Symbol, choices : Array, *, selected : FormOptionsHelper::SelectValue | Nil = nil, disabled : FormOptionsHelper::SelectValue | Nil = nil, include_blank : String | Bool | Nil = nil, prompt : String | Bool | Nil = nil, multiple : Bool = false, include_hidden : Bool = true, **html_opts) : SafeString
Source
submit(value : String = "Save changes", **opts) : SafeString
Source
telephone_field(attr : String | Symbol, **opts) : SafeString
Source
text_area(attr : String | Symbol, **opts) : SafeString

Rails Tags::TextArea: an explicit value: opt wins over the object's attribute value; attribute order opts → name → id (oracle ff_textarea_value).

Source
text_field(attr : String | Symbol, **opts) : SafeString
Source
time_field(attr : String | Symbol, **opts) : SafeString
Source
url_field(attr : String | Symbol, **opts) : SafeString
Source
week_field(attr : String | Symbol, **opts) : SafeString
Source
weekday_select(attr : String | Symbol, *, selected : String | Nil = nil, multiple : Bool = false, include_hidden : Bool = true, **html_opts) : SafeString
Source