class Opal::FormModule::Form

Overview

Declarative multi-field form manager with real-time validation and keyboard navigation.

Defined in:

opal/form/form.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(title : String = "Setup Wizard") #

[View source]

Instance Method Detail

def active_field_idx : Int32 #

[View source]
def active_field_idx=(active_field_idx : Int32) #

[View source]
def confirm(name : String, label : String, default : Bool = false) : ConfirmField #

[View source]
def fields : Array(FormField) #

[View source]
def focus_next : Nil #

[View source]
def focus_prev : Nil #

[View source]
def multi_select(name : String, label : String, options : Array(String), selected : Array(String) = [] of String) : MultiSelectField #

[View source]
def password(name : String, label : String, min_length : Int32 = 0, default : String = "", placeholder : String = "") : PasswordField #

[View source]
def render(buffer : UI::Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil #

[View source]
def run(driver : Terminal::Driver | Nil = nil) : Hash(String, FormValue) | Nil #

Interactively displays and executes the form


[View source]
def select(name : String, label : String, options : Array(String), default_idx : Int32 = 0) : SelectField #

[View source]
def text(name : String, label : String, default : String = "", placeholder : String = "", required : Bool = false) : TextField #

[View source]
def title : String #

[View source]
def update_focus : Nil #

[View source]
def valid? : Bool #

[View source]
def validate(name : String, &validator : String -> String | Nil) : Nil #

[View source]
def validate(name : String, validator : ValidatorFn) : Nil #

[View source]
def validators : Hash(String, Array(ValidatorFn)) #

[View source]
def values : Hash(String, FormValue) #

[View source]