ユーザ用ツール

サイト用ツール


alform:altext

AlText 1行テキスト

1行テキスト入力ボックスです。

コンストラクタ

AlText.new("名前", オプション)

オプション

  • label - ラベル
  • value - 初期値
  • required - 必須入力フラグ
  • filter - 入力フィルタ
  • tag_type - htmlタグ生成時のtype文字列
  • tag_attr - htmlタグ生成時の追加アトリビュート
  • validator - バリデータ
  • min - 最小長さ
  • max - 最大長さ

使用例

初期値指定
AlText.new("text1", :value=>"ABC")

make_tag()出力
<input type="text" name="text1" id="text1" value="ABC">
必須入力フラグ
AlText.new("text1", :required=>true )
入力フィルタ
AlText.new( "text1", :filter=>AlForm::FILTER_STRIP )
htmlタグ生成時のtype文字列
AlText.new("text1", :tag_type=>"color")

make_tag()出力
<input type="color" name="text1" id="text1" value="">
htmlタグ生成時の追加アトリビュート
AlText.new("text1", :tag_attr=>{size:50, maxlength:50})

make_tag()出力
<input type="text" name="text1" id="text1" value="" size="50" maxlength="50">
バリデータ
AlText.new("text1", :validator=>/\A[0-7]{3}\z/ )    # 8進3桁で入力されることを期待
最小最大
AlText.new("text1", :min=>5, :max=>10)              # 5文字以上10文字以下で入力
alform/altext.txt · 最終更新: 2019/03/03 18:27 by hirohito