Form
TsgcHTMLComponent_Form — Delphi, C++ Builder 및 .NET에서 텍스트, 선택, 체크박스, 라디오, 파일, 날짜 및 범위 필드, 유효성 검사, 세로/가로/인라인 레이아웃 및 AI 폼 생성과 함께 Bootstrap 5 폼을 렌더링하는 데이터 기반 폼 빌더입니다.
TsgcHTMLComponent_Form — Delphi, C++ Builder 및 .NET에서 텍스트, 선택, 체크박스, 라디오, 파일, 날짜 및 범위 필드, 유효성 검사, 세로/가로/인라인 레이아웃 및 AI 폼 생성과 함께 Bootstrap 5 폼을 렌더링하는 데이터 기반 폼 빌더입니다.
Fields 컬렉션에서 Bootstrap <form>을 구성하는 폼 컴포넌트입니다. 필드를 추가하고(또는 데이터셋을 바인딩하고), 레이아웃을 선택한 다음, HTML 속성을 읽습니다.
Action, Method 및 Layout을 설정하고, 하나 이상의 Fields를 추가한 다음, HTML을 읽습니다(또는 TsgcHTMLTemplate_Bootstrap 페이지에 넣습니다).
uses
sgcHTML_Enums, sgcHTML_Component_Form;
var
oForm: TsgcHTMLComponent_Form;
oField: TsgcHTMLFormField;
begin
oForm := TsgcHTMLComponent_Form.Create(nil);
try
oForm.Action := '/contact';
oForm.Method := fmPost;
oForm.Layout := flVertical;
oForm.SubmitText := 'Send';
oForm.SubmitStyle := bsPrimary;
oForm.ShowReset := True;
oField := oForm.Fields.Add;
oField.FieldType := ftText;
oField.Name := 'name';
oField.Label_ := 'Full name';
oField.Required := True;
oField := oForm.Fields.Add;
oField.FieldType := ftEmail;
oField.Name := 'email';
oField.Label_ := 'Email';
oField.Placeholder := 'you@example.com';
WebModule.Response := oForm.HTML; // Bootstrap <form> markup
finally
oForm.Free;
end;
end;
// Or build the fields straight from a dataset:
oForm.LoadFromDataSet(qryCustomer);
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Form.hpp
TsgcHTMLComponent_Form *oForm = new TsgcHTMLComponent_Form(NULL);
try
{
oForm->Action = "/contact";
oForm->Method = fmPost;
oForm->Layout = flVertical;
oForm->SubmitText = "Send";
oForm->SubmitStyle = bsPrimary;
oForm->ShowReset = true;
TsgcHTMLFormField *oField = oForm->Fields->Add();
oField->FieldType = ftText;
oField->Name = "name";
oField->Label_ = "Full name";
oField->Required = true;
oField = oForm->Fields->Add();
oField->FieldType = ftEmail;
oField->Name = "email";
oField->Label_ = "Email";
oField->Placeholder = "you@example.com";
String html = oForm->HTML; // Bootstrap <form> markup
}
__finally
{
delete oForm;
}
using esegece.sgcWebSockets;
var form = new TsgcHTMLComponent_Form();
form.Action = "/contact";
form.Method = TsgcHTMLFormMethod.fmPost;
form.Layout = TsgcHTMLFormLayout.flVertical;
form.SubmitText = "Send";
form.SubmitStyle = TsgcHTMLButtonStyle.bsPrimary;
form.ShowReset = true;
var field = form.Fields.Add();
field.FieldType = TsgcHTMLFieldType.ftText;
field.Name = "name";
field.Label_ = "Full name";
field.Required = true;
field = form.Fields.Add();
field.FieldType = TsgcHTMLFieldType.ftEmail;
field.Name = "email";
field.Label_ = "Email";
field.Placeholder = "you@example.com";
string html = form.HTML; // Bootstrap <form> markup
가장 자주 사용하게 되는 멤버.
Fields는 TsgcHTMLFormField의 컬렉션입니다. Fields.Add를 호출하고 FieldType(ftText, ftEmail, ftSelect, ftCheckbox, ftRadio, ftFile, ftDate, ftRange 등), Name, Label_, Value 및 Required를 설정하십시오.
Action과 Method(fmGet / fmPost)가 전송 대상을 지정합니다. FormID는 폼 요소를 식별합니다.
Layout은 flVertical, flHorizontal 또는 flInline을 선택합니다. LabelColWidth와 FieldColWidth가 가로 레이아웃의 열 크기를 정합니다.
SubmitText, SubmitStyle(TsgcHTMLButtonStyle), ShowReset 및 ResetText가 작업 버튼을 제어합니다.
LoadFromDataSet(aDataSet)는 쿼리의 열에서 필드를 생성합니다. LoadValuesFromDataSet(aDataSet)는 현재 행의 값으로 기존 필드를 다시 채웁니다.
AIBuildEnabled와 AIBuildPlaceholder는 프롬프트 바를 추가합니다. BuildFromAIDescription(aDescription)은 OnAIBuildForm을 발생시키고, LoadFieldsFromJSON(aJSON)은 JSON 정의에서 필드를 채웁니다.
SmartPasteEnabled는 폼 위에 붙여넣기 영역을 렌더링합니다. ProcessSmartPaste는 텍스트를 필드 이름, 레이블, 타입과 함께 AIAssistant에 전달하고(폼의 값은 전달하지 않음), 답변을 이름별로 필드에 기록하며 AI가 채웠음을 표시합니다. ClearAIFilled는 그 표시를 지웁니다.