DatePicker

TsgcHTMLComponent_DatePicker — renderuje natywne pole HTML5 daty, godziny lub daty i godziny z opcjonalnym dolnym i górnym ograniczeniem, w Delphi, C++ Builder i .NET.

TsgcHTMLComponent_DatePicker

Komponent pola, który generuje element form-control Bootstrap typu HTML5 date, time lub datetime-local. Wybierz Mode, ustaw ograniczenia, a następnie odczytaj właściwość HTML.

Klasa komponentu

TsgcHTMLComponent_DatePicker

Renderuje

Natywne pole <input> daty/godziny HTML5

Języki

Delphi, C++ Builder, .NET

Utwórz go, ustaw tryb, wyrenderuj

Wybierz Mode, ustaw Name, Label_ oraz ograniczenia MinDate/MaxDate, a następnie odczytaj HTML — albo wywołaj statyczną metodę pomocniczą Build dla jednolinijkowca.

uses
  sgcHTML_Component_DatePicker;

var
  oDate: TsgcHTMLComponent_DatePicker;
begin
  oDate := TsgcHTMLComponent_DatePicker.Create(nil);
  try
    oDate.Mode := dmDate;
    oDate.Name := 'booking';
    oDate.Label_ := 'Booking date';
    oDate.MinDate := '2026-01-01';
    oDate.MaxDate := '2026-12-31';
    oDate.Required := True;

    WebModule.Response := oDate.HTML;   // <input type="date">
  finally
    oDate.Free;
  end;
end;

// Or the static one-liner (name, mode, label, value):
Result := TsgcHTMLComponent_DatePicker.Build('booking', dmDate, 'Booking date');
// includes: sgcHTML_Component_DatePicker.hpp

TsgcHTMLComponent_DatePicker *oDate = new TsgcHTMLComponent_DatePicker(NULL);
try
{
  oDate->Mode = dmDate;
  oDate->Name = "booking";
  oDate->Label_ = "Booking date";
  oDate->MinDate = "2026-01-01";
  oDate->MaxDate = "2026-12-31";
  oDate->Required = true;

  String html = oDate->HTML;   // <input type="date">
}
__finally
{
  delete oDate;
}

// Or the static one-liner:
String html = TsgcHTMLComponent_DatePicker::Build("booking", dmDate, "Booking date");
using esegece.sgcWebSockets;

var date = new TsgcHTMLComponent_DatePicker();
date.Mode = TsgcHTMLDatePickerMode.dmDate;
date.Name = "booking";
date.Label_ = "Booking date";
date.MinDate = "2026-01-01";
date.MaxDate = "2026-12-31";
date.Required = true;

string html = date.HTML;   // <input type="date">

// Or the static one-liner:
string html2 = TsgcHTMLComponent_DatePicker.Build("booking", TsgcHTMLDatePickerMode.dmDate, "Booking date");

Kluczowe właściwości i metody

Składniki, po które sięgasz najczęściej.

Tryb

Mode (TsgcHTMLDatePickerMode) wybiera dmDate, dmTime lub dmDateTime, generując pole HTML5 date, time lub datetime-local.

Pole

Name ustawia atrybut name pola; Label_ renderuje form-label; Value wstępnie wypełnia pole; Placeholder wyświetla tekst podpowiedzi.

Ograniczenia

MinDate i MaxDate ograniczają zakres wyboru za pomocą natywnych atrybutów min i max; Required oznacza pole jako obowiązkowe.

Metoda pomocnicza

Build(name, mode, label, value) zwraca znaczniki w jednej linii bez zarządzania instancją.

Wynik

HTML zwraca kontener mb-3 z etykietą i typowanym form-control; DatePickerID ustawia atrybut id elementu.

Układ

Dziedziczone Section, ColumnWidth i RowGroup umieszczają pole na siatce TsgcHTMLPageBuilder.

Poznawaj dalej

Wszystkie komponenty sgcHTMLPrzejrzyj pełną matrycę funkcji 60+ komponentów.
Pobierz bezpłatną wersję próbną30-dniowa wersja próbna zawiera projekty demonstracyjne 60.HTML.
CennikLicencje Single, Team i Site z pełnym kodem źródłowym.

Gotowy, aby zacząć?

Pobierz bezpłatną wersję próbną i dodaj selektory daty i godziny do swojej aplikacji webowej w Delphi, C++ Builder lub .NET.