From f90bc6c1eea307e484825a212371523546fc76de Mon Sep 17 00:00:00 2001 From: Amigo <49749100+aamigo@users.noreply.github.com> Date: Thu, 19 Sep 2019 11:33:44 +0200 Subject: [PATCH] Updated 059 Adding none database fields to an admin view (markdown) --- 059-Adding-none-database-fields-to-an-admin-view.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/059-Adding-none-database-fields-to-an-admin-view.md b/059-Adding-none-database-fields-to-an-admin-view.md index 92e2898..439bce5 100644 --- a/059-Adding-none-database-fields-to-an-admin-view.md +++ b/059-Adding-none-database-fields-to-an-admin-view.md @@ -1 +1,10 @@ -We've added a new function To JCB which allows you to add a field to a view [00:00:09](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m09s) Without adding the field to the database Now when will that be useful Usually When you have a field which maybe is getting data from another table And You want to actually change the behaviour on the page based on the data selected But that selection itself isn't relevant Or when you want to actually combine two fields As one in the database Then you could have both fields on the page [00:00:41](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m41s) And on submission in your save area in the admin View You can add some custom PHP script To take the value from that other field And actually Save it in to this Field that you intend to Combine the two values And so you don't want both values to be stored in the database Or the other option is you have fields on a page which Actually only get used to generate data in another table [00:01:16](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m16s) So when you save that item it takes those values put it into The other table And basically Leave just one value in this table Which next time you open it up all those fields are hidden based on that value selection Something like that So it's really got multiple implementations and sort of helps you to get A subform on the page Or any kind of other field type To be able to you know use it [00:01:47](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) Once You know what use it within your custom scripting either in JavaScript Or in PHP A previously this wasn't possible if you add a field to view it always gonna get Stored into the database But now If you go to admin views And You well Let's take one [00:02:13](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m13s) That has this function going We use the admin view Fields So you'll see that this new Feature is Replaced your admin view list option Because now you got show in list And then you have the default which was the previous Check or uncheck option Which basically is 1 and 0 [00:02:44](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m44s) But now you got a third one Which is called No DB I have a field called not required which basically is what you would usually add If you are using Conditional JCBs Internal conditional option And you have Fields that actually are required But within certain criteria those fields are hidden And obviously then not required Then I'm using this not required field [00:03:18](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m18s) To basically Store Some values with JavaScript that upon submission It did adapts the validation on the server side Now I don't really want that value in the database so I'm using this Non DB option If you changed any other Fields I'm just gonna do demonstration Obviously I do want this field in the database but just to sort of show you If you select no DB It will automatically give you this notice Basically these two notices [00:03:50](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) The one saying the non DB option Will remove this field from being saved in the database And then this one Only use the non DB option if you're planning on targeting this field With JavaScript or custom PHP To move it's value into another field that does get saved to the database In one form or another basically saying to you But if you use this value we not gonna store whatever is placed In it [00:04:21](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m21s) In the database for you You will need to manually Do that So that's really why it's there it's really for custom customization to your components behaviour And so you'll see that also clears out All your selections because None of these features Will be Of you know be used well a vailable to this field Because this field [00:04:47](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m47s) After saving Dumps is value and it doesn't exist Unless you grab it and you know Use it into your script Ok so If you use the list option We now have this automated Counter adding So [00:05:08](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) Every time you do that if counts all the fields that are available Already in your script And then it adds the next Logic number But anyway that's Beyond of what I'm actually explaining or demonstrating So for now Our Purpose here Is to show you that there is a new No DB [00:05:32](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m32s) Field behaviour Which Some of you have been requesting And I also needed it in the past So it's available now You can try it out play with it And of course if it doesn't make sense to you just don't use it Ok well thanks for watching +# ADDING NONE DATABASE FIELDS TO AN ADMIN VIEW + +### New Function - To Add A Field To A View Without Adding The Field To the Database + +[00:00:00](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m00s) + +We've added a new function to JCB which allows you to add a field to a view without adding the field to the database. When will that be useful? When you have a field which maybe is getting data from another table, and you want to change the behavior on the page, based on the data selected, but that selection itself isn't relevant. Or when you want to combine two fields as one in the database, then you could have both fields on the page. [00:00:41](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m41s) On submission in your save area in the Admin View, you can add some custom PHP script to take the value from that other field, and save it in to this field that you intend to combine the two values. You don't want both values to be stored in the database. Or the other option is you have fields on a page, which only get used to generate data in another table. [00:01:16](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m16s) When you save that item, it takes those values put it into the other table and leave one value in this table. Which next time you open it up all those fields are hidden based on that value selection. + +??? +It have multiple implementations and sort of helps you to get a subform on the page or any kind of other field type to be able to use it [00:01:47](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) once You know what use it within your custom scripting either in JavaScript Or in PHP A previously this wasn't possible if you add a field to view it always gonna get Stored into the database But now If you go to admin views And You well Let's take one [00:02:13](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m13s) That has this function going We use the admin view Fields So you'll see that this new Feature is Replaced your admin view list option Because now you got show in list And then you have the default which was the previous Check or uncheck option Which basically is 1 and 0 [00:02:44](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m44s) But now you got a third one Which is called No DB I have a field called not required which basically is what you would usually add If you are using Conditional JCBs Internal conditional option And you have Fields that actually are required But within certain criteria those fields are hidden And obviously then not required Then I'm using this not required field [00:03:18](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m18s) To basically Store Some values with JavaScript that upon submission It did adapts the validation on the server side Now I don't really want that value in the database so I'm using this Non DB option If you changed any other Fields I'm just gonna do demonstration Obviously I do want this field in the database but just to sort of show you If you select no DB It will automatically give you this notice Basically these two notices [00:03:50](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m50s) The one saying the non DB option Will remove this field from being saved in the database And then this one Only use the non DB option if you're planning on targeting this field With JavaScript or custom PHP To move it's value into another field that does get saved to the database In one form or another basically saying to you But if you use this value we not gonna store whatever is placed In it [00:04:21](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m21s) In the database for you You will need to manually Do that So that's really why it's there it's really for custom customization to your components behaviour And so you'll see that also clears out All your selections because None of these features Will be Of you know be used well a vailable to this field Because this field [00:04:47](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m47s) After saving Dumps is value and it doesn't exist Unless you grab it and you know Use it into your script Ok so If you use the list option We now have this automated Counter adding So [00:05:08](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m08s) Every time you do that if counts all the fields that are available Already in your script And then it adds the next Logic number But anyway that's Beyond of what I'm actually explaining or demonstrating So for now Our Purpose here Is to show you that there is a new No DB [00:05:32](https://www.youtube.com/watch?v=6OTRDIgxgq0&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m32s) Field behaviour Which Some of you have been requesting And I also needed it in the past So it's available now You can try it out play with it And of course if it doesn't make sense to you just don't use it Ok well thanks for watching