Updated 045 Adding your own rule validation to a field in JCB (markdown)

Amigo 2019-08-24 15:56:36 +02:00
parent 81d8058bac
commit 331fd9b9aa

@ -3,7 +3,7 @@
[00:00:00](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
(_Click on these time links to see Youtube video_)
I would like to demonstrate to you how to add rules to your Model, basically to a Field. Adding rules to a Field, uses your custom rules to test the value before submitting it to the database. This is quite a good feature to have in your Component. [00:00:32](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s) I'm just going to use Hello World Component. The one we did a Hello World tutorial on. I'm going to add a rule to one of its Fields. Then quickly type it up and show you how to include it. I've gone to Admin Views. I'm going to open Greeting (first) as the Admin View. We want to change the Field in it. I think let us used this Greetings. [00:01:11](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m11s) Now we see at this time that the Field attributes don't have the validation option switch in place. We might start shipping JCB with this new validation property, well it is not new, it's just not being added yet, but if you have a version of JCB that doesn't have it set, then whatever Fieldtype you've selected you can edit the Fieldtype going here(green button), or you could edit the Fieldtype by going to Fieldtypes. [00:01:47](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) Close out of Edit the Admin View again. And then go to Fieldtypes in Admin View.
I would like to demonstrate how to add rules to the Model, basically to a Field. The custom rules are used to test a value before submitting it to the database. This is quite a good feature to have in your Component. [00:00:32](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m32s) For this demonstration the Hello World Component are going to be used and rule is going to be added to one of its Fields. Open Greeting (first) as the Admin View. To change the Field in it this(See video) 'Greetings' are used. [00:01:11](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m11s) The Field attributes do not have the validation option switch in place. We might start shipping JCB with this new validation property which is not new, it has just not being added yet. If you have a version of JCB that does not have it set, then whatever Fieldtype which is selected and can be edited by going to the green button, or you could edit the Fieldtype by going to Fieldtypes. [00:01:47](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) Close out of Edit the Admin View again then go to Fieldtypes in Admin View. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
### Select Fieldtype To Add Validation - Textarea