module Motion::HTML::InputHelpers

Direct including types

Defined in:

motion/html/tags/input_helpers.cr

Constant Summary

EMPTY_BOOLEAN_ATTRIBUTES = [] of Symbol

Instance Method Summary

Macro Summary

Instance Method Detail

def checkbox(field : Avram::PermittedAttribute(T), unchecked_value : String, checked_value : String, **html_options) : Nil forall T #

[View source]
def checkbox(field : Avram::PermittedAttribute(Bool | Nil), attrs : Array(Symbol), **html_options) : Nil #

[View source]
def checkbox(field : Avram::PermittedAttribute(Bool | Nil), **html_options) : Nil #

[View source]
def checkbox(field : Avram::Attribute, **options) #

[View source]
def color_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to color_input; this allows for Boolean attributes through attrs.

color_input(attribute, attrs: [:required])
# => <input type="color" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def color_input(field : Avram::Attribute, **options) #

def color_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a color input field.

color_input(attribute)
# => <input type="color" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def date_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

[View source]
def date_input(field : Avram::Attribute, **options) #

[View source]
def date_input(field : Avram::PermittedAttribute, **html_options) : Nil #

[View source]
def datetime_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

[View source]
def datetime_input(field : Avram::Attribute, **options) #

[View source]
def datetime_input(field : Avram::PermittedAttribute, **html_options) : Nil #

[View source]
def email_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to email_input; this allows for Boolean attributes through attrs.

email_input(attribute, attrs: [:required])
# => <input type="email" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def email_input(field : Avram::Attribute, **options) #

def email_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a email input field.

email_input(attribute)
# => <input type="email" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def file_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to file_input; this allows for Boolean attributes through attrs.

file_input(attribute, attrs: [:required])
# => <input type="file" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def file_input(field : Avram::Attribute, **options) #

def file_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a file input field.

file_input(attribute)
# => <input type="file" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def hidden_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to hidden_input; this allows for Boolean attributes through attrs.

hidden_input(attribute, attrs: [:required])
# => <input type="hidden" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def hidden_input(field : Avram::Attribute, **options) #

def hidden_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a hidden input field.

hidden_input(attribute)
# => <input type="hidden" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def number_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to number_input; this allows for Boolean attributes through attrs.

number_input(attribute, attrs: [:required])
# => <input type="number" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def number_input(field : Avram::Attribute, **options) #

def number_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a number input field.

number_input(attribute)
# => <input type="number" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def password_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

[View source]
def password_input(field : Avram::Attribute, **options) #

[View source]
def password_input(field : Avram::PermittedAttribute, **html_options) : Nil #

[View source]
def radio(field : Avram::PermittedAttribute(String | Nil), checked_value : String, attrs : Array(Symbol), **html_options) : Nil #

Similar to radio; this allows for Boolean attributes through attrs.

radio(attribute, "checked_value", attrs: [:required])
# => <input type="radio" id="param_key_attribute_name_checked_value" name="param_key:attribute_name" value="checked_value" checked="true" required />

[View source]
def radio(field : Avram::PermittedAttribute(String | Nil), checked_value : String, **html_options) : Nil #

Returns a radio input field.

radio(attribute, "checked_value")
# => <input type="radio" id="param_key_attribute_name_checked_value" name="param_key:attribute_name" value="checked_value" checked="true">

[View source]
def radio(field : Avram::Attribute, **options) #

[View source]
def range_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to range_input; this allows for Boolean attributes through attrs.

range_input(attribute, attrs: [:required])
# => <input type="range" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def range_input(field : Avram::Attribute, **options) #

def range_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a range input field.

range_input(attribute)
# => <input type="range" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def search_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to search_input; this allows for Boolean attributes through attrs.

search_input(attribute, attrs: [:required])
# => <input type="search" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def search_input(field : Avram::Attribute, **options) #

def search_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a search input field.

search_input(attribute)
# => <input type="search" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def submit(text : String, **html_options) : Nil #

[View source]
def telephone_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

[View source]
def telephone_input(field : Avram::Attribute, **options) #

[View source]
def telephone_input(field : Avram::PermittedAttribute, **html_options) : Nil #

[View source]
def text_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to text_input; this allows for Boolean attributes through attrs.

text_input(attribute, attrs: [:required])
# => <input type="text" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def text_input(field : Avram::Attribute, **options) #

def text_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a text input field.

text_input(attribute)
# => <input type="text" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]
def textarea(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to textarea; this allows for Boolean attributes through attrs.

textarea(attribute, attrs: [:required])
# => <textarea id="param_key_attribute_name" name="param_key:attribute_name" required></textarea>

[View source]
def textarea(field : Avram::Attribute, **options) #

[View source]
def textarea(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a textarea field.

textarea(attribute)
# => <textarea id="param_key_attribute_name" name="param_key:attribute_name"></textarea>

[View source]
def time_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

[View source]
def time_input(field : Avram::Attribute, **options) #

[View source]
def time_input(field : Avram::PermittedAttribute, **html_options) : Nil #

[View source]
def url_input(field : Avram::PermittedAttribute, attrs : Array(Symbol), **html_options) : Nil #

Similar to url_input; this allows for Boolean attributes through attrs.

url_input(attribute, attrs: [:required])
# => <input type="url" id="param_key_attribute_name" name="param_key:attribute_name" value="" required />

[View source]
def url_input(field : Avram::Attribute, **options) #

def url_input(field : Avram::PermittedAttribute, **html_options) : Nil #

Returns a url input field.

url_input(attribute)
# => <input type="url" id="param_key_attribute_name" name="param_key:attribute_name" value="" />

[View source]

Macro Detail

macro error_message_for_unallowed_field #

[View source]
macro generate_helpful_error_for(input_method_name) #

[View source]