Edit

TsgcHTMLComponent_Edit — Delphi、C++ Builder、.NET で、ラベル、ヘルプテキスト、入力タイプ、データセットバインディングを備え、Bootstrap 5 の form-control をレンダリングする 1 行テキスト入力欄です。

TsgcHTMLComponent_Edit

ラベル付きの Bootstrap <input> を出力するスタンドアロンのテキスト入力欄です。名前、ラベル、入力タイプを設定してから、HTML プロパティを読み取ります。兄弟コンポーネントの Memo、CheckBox、RadioGroup の各入力と同じユニットに含まれています。

コンポーネントクラス

TsgcHTMLComponent_Edit

レンダリング内容

Bootstrap 5 の form-control 入力欄

ファミリー

フォーム & 入力

言語

Delphi, C++ Builder, .NET

作成し、設定し、レンダリングする

NameLabel_InputType、そして Placeholder を設定してから、HTML を読み取ります(または TsgcHTMLTemplate_Bootstrap ページに組み込みます)。

uses
  sgcHTML_Enums, sgcHTML_Component_Edit;

var
  oEdit: TsgcHTMLComponent_Edit;
begin
  oEdit := TsgcHTMLComponent_Edit.Create(nil);
  try
    oEdit.Name := 'email';
    oEdit.Label_ := 'Email address';
    oEdit.InputType := itEmail;
    oEdit.Placeholder := 'you@example.com';
    oEdit.HelpText := 'We never share it.';
    oEdit.Required := True;

    WebModule.Response := oEdit.HTML;   // Bootstrap form-control
  finally
    oEdit.Free;
  end;
end;

// Or bind it to a dataset field:
oEdit.DataField := 'Email';
oEdit.DataSource := dsCustomer;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Edit.hpp

TsgcHTMLComponent_Edit *oEdit = new TsgcHTMLComponent_Edit(NULL);
try
{
  oEdit->Name = "email";
  oEdit->Label_ = "Email address";
  oEdit->InputType = itEmail;
  oEdit->Placeholder = "you@example.com";
  oEdit->HelpText = "We never share it.";
  oEdit->Required = true;

  String html = oEdit->HTML;   // Bootstrap form-control
}
__finally
{
  delete oEdit;
}
using esegece.sgcWebSockets;

var edit = new TsgcHTMLComponent_Edit();
edit.Name = "email";
edit.Label_ = "Email address";
edit.InputType = TsgcHTMLInputType.itEmail;
edit.Placeholder = "you@example.com";
edit.HelpText = "We never share it.";
edit.Required = true;

string html = edit.HTML;   // Bootstrap form-control

主なプロパティとメソッド

最もよく使うメンバーです。

Identity

Name はフィールド名を、Label_ は表示用のキャプションを、EditID は要素 id(既定値は edit_<Name>)を設定します。

Value & hint

Value は入力欄に初期値を設定し、Placeholder はゴーストテキストを表示し、HelpText はフィールドの下に Bootstrap の form-text ヒントを追加します。

Input type

InputTypeTsgcHTMLInputType です — itTextitEmailitPassworditNumberitTelitURLitDateitColoritRangeitFile など。

State

RequiredDisabledReadOnly は、検証と編集のために入力欄にフラグを立てます。

Dataset binding

DataField と割り当てた DataSource によって、現在のレコードから Value を埋めます。

Output & siblings

HTML はラベル付きの form-control を返します。同じユニットには、兄弟コンポーネントの TsgcHTMLComponent_MemoTsgcHTMLComponent_CheckBoxTsgcHTMLComponent_RadioGroup の各入力が宣言されています。

さらに詳しく

すべての sgcHTML コンポーネント60 以上のコンポーネントの全機能マトリックスを閲覧できます。
無料体験版のダウンロード30 日間の体験版には 60.HTML デモプロジェクトが付属します。
価格完全なソースコード付きの Single、Team、Site ライセンス。

始める準備はできましたか?

無料体験版をダウンロードして、Delphi、C++ Builder、.NET で Web UI の構築を始めましょう。