Core Docs

Textbox

Input text 1 dòng — bind giá trị string vào property của entity.

Source: Core/Components/Textbox.cs ComponentType trong DB: Input (alias chính) · Password (Textbox với Password=true) · Textbox (qua reflection — cũng được).

Cấu hình

ComType:    Input              # alias = Textbox; dùng "Password" cho ô mật khẩu
FieldName:  Code
Label:      Mã khách hàng
ShowLabel:  true
UpperCase:  true

Field DB dùng

FieldVai trò
FieldNameProperty của entity bind vào input. Hỗ trợ dotted path (Address.Street).
LabelText label hiển thị (cùng ShowLabel).
ShowLabelTrue → render <label> cạnh input.
UpperCaseTrue → auto chuyển string sang chữ hoa khi blur.
FormatDataTemplate áp lên value của field. Vd "{Code}", "MÃ: {0}". Engine: Utils.FormatEntity.
FormatEntityTemplate áp lên toàn bộ entity, ghép nhiều field. Vd "{Code} - {Name}". Override FormatData nếu cả 2 set.
RefNameTên entity tham chiếu (khi field bind tới FK string).
EventsJSON map {event-type: methodName} để wire vào method C# (Change, Input).
MigrationScript migration nội bộ (rare — chỉ admin form).
PlainTextTrue → bỏ qua URL-encode 6 ký tự đặc biệt (+ / ? # & '), lưu raw.
ChildStyleInline CSS style apply lên <input> element bên trong.
AutoFitTrue → input co giãn theo độ dài nội dung.

Events kích hoạt

EventMethod signatureKhi nào fire
change(entity, newValue, oldValue, parent)Blur hoặc Enter, value đã thay đổi.
input(entity)Mỗi keystroke (chỉ khi cần realtime).
{ "change": "OnCodeChanged" }
public class CustomerDetailBL : PopupEditor
{
    public CustomerDetailBL() : base(nameof(Customer)) { }

    public void OnCodeChanged(object entity, object newVal, object oldVal, object parent)
    {
        Toast.Small("Mã đã đổi: " + newVal);
    }
}

Tip

  • UpperCase = true → auto chuyển sang chữ hoa khi blur.
  • URL-encode mặc định bật (KHÔNG phải HTML encode). Trước khi lưu, 6 ký tự + / ? # & ' bị encode thành %2B %2F %3F %23 %26 %27 (xem Utils.SpecialChar). Khi đọc, decode lại. Mục đích: tránh các ký tự này phá OData querystring (?$filter=Code eq 'ACME&Co' thì & bị hiểu nhầm là separator).
  • Tắt encode bằng Feature.IgnoreEncode = true (lưu raw — chấp nhận rủi ro nếu giá trị xuất hiện trong filter URL).
  • Password field: set Password = true qua property C# (không có field DB tương ứng).

Core Docs · Astro · Core.API/wwwRoot/docs