|
1 | | -# C4D-Validate-Components |
2 | | -Framework para validação automática de formulários Delphi |
| 1 | +# C4D Validate Components |
| 2 | +<p align="center"> |
| 3 | + <a href="https://github.com/Code4Delphi/Code4D-Wizard/blob/master/Images/C4D-Logo.png"> |
| 4 | + <img alt="Code4Delphi" height="100" src="https://github.com/Code4Delphi/Code4D-Wizard/blob/master/Images/c4d-logo-100x100.png"> |
| 5 | + </a> |
| 6 | +</p> |
| 7 | +Utility for automatic validation of Delphi forms |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## 📞 Contacts |
| 12 | + |
| 13 | +<p align="left"> |
| 14 | + <a href="https://t.me/Code4Delphi" target="_blank"> |
| 15 | + <img src="https://img.shields.io/badge/Telegram:-Join%20Channel-blue?logo=telegram"> |
| 16 | + </a> |
| 17 | + |
| 18 | + <a href="mailto:contato@code4delphi.com.br" target="_blank"> |
| 19 | + <img src="https://img.shields.io/badge/E--mail-contato%40code4delphi.com.br-yellowgreen?logo=maildotru&logoColor=yellowgreen"> |
| 20 | + </a> |
| 21 | + |
| 22 | + <a href="https://go.hotmart.com/U81331747Y?dp=1" target="_blank"> |
| 23 | + <img src="https://img.shields.io/badge/Course:-Open%20Tools%20API-F00?logo=delphi"> |
| 24 | + </a> |
| 25 | + |
| 26 | + <a href="https://www.youtube.com/@code4delphi" target="_blank"> |
| 27 | + <img src="https://img.shields.io/badge/YouTube:-Join%20Channel-red?logo=youtube&logoColor=red"> |
| 28 | + </a> |
| 29 | +</p> |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +## ⚙️ Instalação |
| 34 | + |
| 35 | +* Installation using the [**Boss**](https://github.com/HashLoad/boss): |
| 36 | + |
| 37 | +``` |
| 38 | +boss install github.com/Code4Delphi/C4D-Validate-Components |
| 39 | +``` |
| 40 | + |
| 41 | +* **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* |
| 42 | + |
| 43 | +``` |
| 44 | +..\C4D-Validate-Components\Src |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +## 🚀 Como usar |
| 50 | +* Add uses to your system: |
| 51 | +``` |
| 52 | +uses |
| 53 | + C4D.Validate.Components; |
| 54 | +``` |
| 55 | + |
| 56 | +* Insert the Custom Attributes on the component declaration you want to validate: |
| 57 | +``` |
| 58 | +[FieldDisplay('Name')] |
| 59 | +[NotEmpty] |
| 60 | +[Length(5, 15)] |
| 61 | +edtName: TEdit; |
| 62 | +``` |
| 63 | + |
| 64 | +* Make the call for form validation: |
| 65 | +``` |
| 66 | +TC4DValidateComponents.Validate(TClasseDoForm, Self); |
| 67 | +``` |
| 68 | + |
| 69 | +## Custom Attributes available: |
| 70 | + |
| 71 | +* Name to be displayed if there are errors: |
| 72 | +``` |
| 73 | +[FieldDisplay('Name to be displayed')] |
| 74 | +``` |
| 75 | + |
| 76 | +* Validates so that the field is not empty: |
| 77 | +``` |
| 78 | +[NotEmpty] |
| 79 | +``` |
| 80 | + |
| 81 | +* Enter a minimum and/or maximum number of characters for the field: |
| 82 | +``` |
| 83 | +[Length(5, 15)] |
| 84 | +``` |
| 85 | + |
| 86 | +* Enter the minimum and/or maximum value that must be entered in the field: |
| 87 | +``` |
| 88 | +[MinMaxValue(5, 10)] |
| 89 | +``` |
| 90 | + |
| 91 | +* Enter the minimum and/or maximum date that must be entered in the field |
| 92 | +``` |
| 93 | +[MinMaxDate('01/12/2023', '10/12/2023')] |
| 94 | +``` |
| 95 | + |
| 96 | +## ⌨️ Demo |
| 97 | +* Next to the project sources, you will find a test project, in the folder: |
| 98 | +``` |
| 99 | +C4D-Validate-Components\Samples\Demo01 |
| 100 | +``` |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +# 💬 Contributions / Ideas / Bug Fixes |
| 105 | +To submit a pull request, follow these steps: |
| 106 | + |
| 107 | +1. Fork the project |
| 108 | +2. Create a new branch (`git checkout -b minha-nova-funcionalidade`) |
| 109 | +3. Make your changes |
| 110 | +4. Make the commit (`git commit -am 'Functionality or adjustment message'`) |
| 111 | +5. Push the branch (`git push origin Message about functionality or adjustment`) |
| 112 | +6. Open a pull request |
0 commit comments