Skip to content

066 The new fields Area to make things easier

Amigo edited this page Oct 14, 2019 · 14 revisions

THE NEW FIELDS AREA TO MAKE THINGS EASIER

Explaining Changes In The Field Area

00:00:08 (Click on these time links to see Youtube video)

I would like to explain a little bit more about all the changes that had been made to the field area. The field area is really the foundation a great part of your component. It is what causes many of the behavior and concepts which is in your views. The field area had been a difficult area to change and it is still in progress. The interface most probably will not change much, 00:00:38 just little tweaks here and there. The back-end of how we deal with the data will certainly be improved.

A Quick Recap How It Used To Look

00:00:46

Just a quick recap of how it used to look. If we go to an older install of JCB and open a field. If the Alias is opened, we would see that it has this XML field definition area. In the past it was very easy to leave out, maybe leaving out anything by accident, change something and then it breaks. We had a lot of freedom and as developers, I am sure this did not feel in any way to be a problem. Whatever you have selected we build the XML for you and you could just adapt it as you please. 00:01:33 Since we are trying to make JCB more stable and eventually much more user-friendly. This new feature was suggested by the team. Therefore the decision was made to add it.

Removed The XML Definition Area Replaced It with Sub-form

00:01:55

What had been done? We removed this XML definition and we have replaced it with a sub-form. We've moved the database values to its own tabs. We also moved the field information to its own tab. We added a lot of structures and tools to the page. Let's show you that. Version 2.7.5 00:02:28 which is the stable release of this change. If we open that same Alias which we did just now, you will see it looks like this now(see video). You have a sub-form, with those values in a sub-form layout. You have a lot of new information. It also has the Database in its own tab. The Type Info is still available and you can still come and 00:02:58 review. The new option still gives you the ability to add those fields which are not already on the page. You could still say I want to add 'size'. We still load the description of the field on the page in the default value, which you can then change. Except when it tells you that it must be text. We have not yet 00:03:31 blocked this field from being changed or being removed, though it is mandatory. If you do leave it out on compiling, the component we will detect that it is mandatory. If you did not add value, it will fall back to its default value. 00:03:59 That is how it currently behaves. I wouldn't develop it in that way, best practice is to put in the value and make sure that is correct. That is the new Field area. There have been some hiccups and 00:04:23 bugs which we have ironed out the predominantly all those we know about. We also added this new option, we have not fully released some of the features but there is this option which is going to separate if you use the custom Field currently. It adds the PHP in the rows which 00:04:50 is a little tedious if you want to change this to keep track of the open braces.

New Implemetation For Custom Fields and Custom User

00:05:00

Just a little peek of what has been done. It will be in version 2.7.6. If you have watched this video after those releases you possibly already have it. Click on New, this is New implementation for the Custom Fields and also for Custom user. You click on it, it will take the PHP and adds it to its own little text area. Now you can easily follow and adapt the 'getOptions' method PHP values. That is 00:05:40 quite more convenient I suppose than using one line at a time. If we look at the user, you have two fields then, one for the 'getExclude' method and one for the 'getGroup' method. They are also immediately available to you.

Advantage - Extra Properties Options - Listclass Option

00:06:05

The other advantage of this implementation is, we have this new Extra properties option which has been available in JCB for some time. Many of you may not know that it exists. There is what we call 'listclass'. If you want to add a class like a CSS class value to the field when it appears in the list area. 00:06:29 Let me show you this area(see video), this is the list area. Well, any of the views where you see a list of items and you want this specific value to have a specific CSS class value because maybe you want to style it somewhat differently. Then you have this option to use. All you need to do is 00:06:53 click 'listclass' and you add there 'my-class-dean'. Whatever you want to call it. It will add that the class to the 00:07:15 field in the list area which is quite stunning.

Escape Option

00:07:19

There is also the 'Escape' Option. If you escape a value, all the values are escaped by default. If you want a value not to be escaped because you are going to have values in it, which if it's escaped, it gets stripped like a span tag and stuff like that. You could say: 'false' and then the specific fields. Now when I say escaped, I mean in the list area, again this area. When there is a list value. Then this is a being escaped at the moment. If you do not want that done, then you can add this false escaped.

Display Option

00:08:06

The other option is also available. It is the 'Display option'. We will still add some more documentation to this, but it is about when the field gets displayed in config, it is when a component has this options area. You can add Fields to that option area. When a field is added to the option area, it has implementation structures. You can let it show in the menu, you can let it show in various places. 00:08:43 I will make a tutorial about this specifically. But just to show you quickly that that is also are available.

Validate Option

00:08:53

Last but not least, there is 'Validate'. Not all fields have the property to validate the value. There are Validation Rules. You can add a validation to this field if that property is not available in the field type, which you have selected. If it is, we would suggest that you add it to the properties at the top. It says that, if you have a validation set as a field property, this extra property will not be needed because you can just use that one. 00:09:33

That was a quick demonstration of the new field area. We trust that it will be as easy and as comfortable as we hoped it would be. Trust that this change would not frustrate you, but be great. Because of one of the unforeseen 00:10:00 outcomes, for example, maybe, if you have a field like this which already has all its values and you are thinking of changing it and say, let me just check how will the text look. You can change it and it really adds all your text value with its defaults. If you say no, I want to go back, you can click back, and your values which were there originally has 00:10:25 again been added to the page. That is even true if you were to remove a specific property and you want to add it back, it adds the original value back because by accident 00:10:48 you might remove it and want to just put it back. It should be as easy as that. You could still go to 'Type Info' to see what could be the default values and adapt them. It is not like you do not have access to the default values, it is just that we want to 00:11:10 recover your current saved value for you. Whenever you add another field that is not already here, this drop-down list only shows the fields that are not already on the page. You will not end up adding field properties the second time. It has become much easier to build fields and their properties as before. 00:11:39 You really had to navigate through some of the complexities of dealing with an XML set of values of which maybe some of you do not know what is going on. Those of you that do, I mean it is not like you are losing any advantage with the new implementation, 00:12:02 you are still targeting that value with any value you want. It is still as easy as clicking a plus and selecting a value and adding it. I do hope that all of you will be as excited about this change as we are. We are now at the point where making JCB easy-to-use is also a priority.

Clone this wiki locally