Skip to content

Code4Delphi/C4D-Validate-Components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C4D Validate Components

Code4Delphi

Utility for automatic validation of Delphi forms

📞 Contacts

     

⚙️ Instalação

  • Installation using the Boss:
boss install github.com/Code4Delphi/C4D-Validate-Components
  • Manual installation: Open your Delphi and add the following folder to your project, under Project > Options > Resource Compiler > Directories and Conditionals > Include file search path
..\C4D-Validate-Components\Src

🚀 Como usar

  • Add uses to your system:
uses
  C4D.Validate.Components;
  • Insert the Custom Attributes on the component declaration you want to validate:
[FieldDisplay('Name')]
[NotEmpty]
[Length(5, 15)]
edtName: TEdit;
  • Make the call for form validation:
TC4DValidateComponents.Validate(TClasseDoForm, Self);

Custom Attributes available:

  • Name to be displayed if there are errors:
[FieldDisplay('Name to be displayed')]
  • Validates so that the field is not empty:
[NotEmpty]
  • Enter a minimum and/or maximum number of characters for the field:
[Length(5, 15)]
  • Enter the minimum and/or maximum value that must be entered in the field:
[MinMaxValue(5, 10)]
  • Enter the minimum and/or maximum date that must be entered in the field
[MinMaxDate('01/12/2023', '10/12/2023')]

⌨️ Demo

  • Next to the project sources, you will find a test project, in the folder:
C4D-Validate-Components\Samples\Demo01

💬 Contributions / Ideas / Bug Fixes

To submit a pull request, follow these steps:

  1. Fork the project
  2. Create a new branch (git checkout -b minha-nova-funcionalidade)
  3. Make your changes
  4. Make the commit (git commit -am 'Functionality or adjustment message')
  5. Push the branch (git push origin Message about functionality or adjustment)
  6. Open a pull request