Edit

TsgcHTMLComponent_Edit — 一个单行文本输入,带有标签、帮助文本、输入类型和数据集绑定,渲染 Bootstrap 5 form-control,适用于 Delphi、C++ Builder 和 .NET。

TsgcHTMLComponent_Edit

一个独立的文本输入,发出带标签的 Bootstrap <input>。设置名称、标签和输入类型,然后读取 HTML 属性。它与同级的 Memo、CheckBox 和 RadioGroup 输入位于同一单元中。

组件类

TsgcHTMLComponent_Edit

渲染为

Bootstrap 5 form-control 输入

语言

Delphi, C++ Builder, .NET

创建它、配置它、渲染它

设置 NameLabel_InputTypePlaceholder,然后读取 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

关键属性与方法

您最常使用的成员。

标识

Name 设置字段名称,Label_ 设置可见标题,EditID 设置元素 id(默认为 edit_<Name>)。

值与提示

Value 为输入框预设内容,Placeholder 显示占位文本,HelpText 在字段下方添加一个 Bootstrap form-text 提示。

输入类型

InputType 是一个 TsgcHTMLInputTypeitTextitEmailitPassworditNumberitTelitURLitDateitColoritRangeitFile 等。

状态

RequiredDisabledReadOnly 为输入框标记验证和编辑状态。

数据集绑定

DataField 加上已赋值的 DataSource 会从当前记录填充 Value

输出与同级

HTML 返回带标签的 form-control。同一单元声明了同级的 TsgcHTMLComponent_MemoTsgcHTMLComponent_CheckBoxTsgcHTMLComponent_RadioGroup 输入。

继续探索

所有 sgcHTML 组件浏览 60 多个组件的完整功能矩阵。
下载免费试用版30 天试用版附带 60.HTML 演示项目。
价格Single、Team 和 Site 授权,均含完整源代码。

准备好开始了吗?

下载免费试用版,开始在 Delphi、C++ Builder 和 .NET 中构建 Web 界面。