Updated 053 Quick Subform Demonstration (markdown)
parent
9be4a6bccb
commit
99df8a8e2c
@ -33,7 +33,7 @@ If you have not looked at all the tutorials that are available on YouTube, then
|
||||
|
||||
[00:03:51](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m51s)
|
||||
|
||||
This formsource(Optional) - it reads as follows: 'You can add a path to an XML file containing the fields'. So a custom XML file can be added to your component. How to add custom files to component, is a whole another topic. It is also possible within the Joomla Component to add files and folders, etc. That means this specific source can still be used but you do not need to. If you use the fields option then you need to remove the source option. [00:04:23](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m23s) Either the one or the other of these options should be used. Currently, the fields are set to mandatory. By going to the field types it can be changed to be optional and then you can select other fields or formsource. The compiler will, in any case, detects a formsource will behave correctly.
|
||||
This formsource(Optional) - it reads as follows: 'You can add a path to an XML file containing the fields'. So a custom XML file can be added to your component. How to add custom files to component, is a whole another topic. It is also possible within the Joomla Component to add files and folders, etc. That means this specific source can still be used but you do not need to. If you use the fields option then you need to remove the source option. [00:04:23](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m23s) Either the one or the other of these options should be used. Currently, the fields are set to mandatory. By going to the field types it can be changed to be optional and then you can select other fields or Formsource. The compiler will, in any case, detects a formsource will behave correctly.
|
||||
|
||||
### Adding IDs
|
||||
|
||||
@ -45,12 +45,12 @@ IDs need to be added which we find in Fields. It should have 'Name', it is just
|
||||
|
||||
[00:05:33](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m33s)
|
||||
|
||||
Then add a Description, a Maximum, a Filter and a Showon. The validation of these fields, that is an area that I have not looked into. Perhaps they moved away from Repeatable Fields because every field is validated on its own merit. [00:06:05](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m05s) For example, the Name field, if you create a Name field, you want this to be a string and it has this filter string value. Since this is part of the XML it will be validated on this. I have not looked at the code. That is what I suppose it will do. In most cases, I suppose that it does not and try and do some custom scripting but I am not going to illustrate that now. [00:06:44](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m44s) There are many tutorials to show you how to do custom scripting in a component and even to do custom scripting in any area of the component through the custom code area implementation.<<<<<<<
|
||||
Then add a Description, a Maximum, a Filter and a Showon. The validation of these fields, that is an area that I have not looked into. Perhaps they moved away from Repeatable Fields because every field is validated on its own merit. [00:06:05](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m05s) For example, the Name field, if you create a Name field, you want this to be a string and it has this filter string value. Since this is part of the XML it will be validated on this. I have not looked at the code. That is what I suppose it will do. In most cases, I suppose that it does not and try and do some custom scripting but I am not going to illustrate that now. [00:06:44](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m44s) There are many tutorials to show you how to do custom scripting in a component and even to do custom scripting in any area of the component through the custom code area implementation.
|
||||
|
||||
[00:07:15](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m15s) I'm going to save this, just give it a Name: Options (test), so I can see it. This Data Type I would make TEXT. The default means that JCB (the Store method) already will detect that this is a Subform and will add the needed [00:07:39](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m39s) PHP in storing the file and in loading the file into the form again. So that takes care of that. So you don't need to say Json, it will on its own by its default do the correct implementation. In the Data Type so you need to make sure either to click TEXT or MEDIUMTEXT depending on what this value is going to be. Anyway, I think for 50 text is quite enough. Save and close.
|
||||
[00:07:15](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m15s) Save this and give it a Name: Options (test) so that it can be seen. For this (DataType), I would make 'TEXT'. The default means that JCB (the Store method) already will detect that this is a Subform and will add the needed [00:07:39](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m39s) PHP in storing the file and in loading the file into the form again. So that takes care of that. So you don't need to select JSON, it will by default do the correct implementation. In the Data Type so you need to make sure either to click TEXT or MEDIUMTEXT depending on what this value is going to be. Save and close.
|
||||
|
||||
### Adding Options(test) Subforms To Any Admin View - See Video
|
||||
### Adding Options(test) Subforms To Any Admin View
|
||||
|
||||
[00:08:19](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m19s)
|
||||
|
||||
Let's see we got that field. I'm going to add it to any admin view for now. I'm going to add it to Look View, that we can see it in action. The look view is part of the Demo component. I'm just going to dump it here. Let's see the above tab, full width, details, description. I think let's just add it there. Details also full width, make it the 2nd, and I say [00:08:49](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m49s) Options(test). Save and close. We've added it to a view. Now I'm just going to compile this component which the view belongs to. Which at this stage it is demo and install it. Now let's go open that Demo component, and open Looks. And here we go, enter name here, enter website address, enter email. We click the green plus button [00:09:26](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m26s) and our values are there. Let's just save one. Children. We can do I think that's the only one. (see video)Let's do that and by entering those values I'm just going to grab joomlamount.com up here, [00:09:55](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m55s) paste it in there a few times. I'm going to put Joomla@vdm.io in Email. To get sort of a feel for it. Save. It saved the values, it loaded it back, it's done all of that. 'Hi, there' then save and close. [00:10:45](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) If we open it again, it shows it up again. We can shuffle it, put number four on top. Save and close. Open again and so it is loading it also correctly. That's a quick demonstration Marco I hope this helps [00:11:09](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m09s) and getting you able to use subforms with JCB. It's as easy as that.
|
||||
Add this field Options(test) to any admin view, for instance, to Look View, to see it in action. The Look view is part of the Demo component. I am going to dump it here. Look at the above tab, full width, details, description. Let's just add it to details, full width, make it 2nd, and say Options(test). [00:08:49](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m49s) Save and close. We have added it to a view. Now I am just going to compile this component which the view belongs to. At this stage, it is demo and installs it. Open that Demo component, and open Looks. Enter Name here, enter the website address, enter an email. Click the green plus button and the values are there. [00:09:26](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m26s) Let's just save one. 'Children'. (_Please follow on video_) Save. It saved the values and loaded it back, it has done all of that. 'Hi, there' then save and close. [00:10:45](https://www.youtube.com/watch?v=3j4xPQC4apI&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) If we open it again, it shows it up again. We can shuffle it, put number four on top. Save and close. Open again and so it is loading it also correctly.
|
||||
|
Loading…
Reference in New Issue
Block a user