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

Amigo 2019-08-09 15:26:53 +02:00
parent 500d60011d
commit c7f4315fb5

@ -1,7 +1,8 @@
# ADDING YOUR OWN RULE VALIDATION TO A FIELD IN JCB
[00:00:00](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s)
I would like to demonstrate to you [00:00:05](https://www.youtube.com/watch?v=Z6-ggKtX35o&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m05s) 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 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.
### Select Fieldtype To Add Validation - Textarea