Show lightbox field based on other value conditionally

I am showing lightbox as:

       gantt.locale.labels["section_priority"] = "Priority";
       gantt.locale.labels["section_progress"] = "Progress";
       gantt.locale.labels.section_baseline = "Planned";
       gantt.config.lightbox.sections = [
           { name: "description", height: 38, map_to: "text", type: "textarea", focus: true },
           { name: "time", type: "duration", map_to: "auto" },
           {name: "baseline", height: 72, map_to: {start_date: "planned_start", end_date: "planned_end"}, type: "duration"}
       ];

I want to hide baseline, if the lock of this particular task is 1. So, for example if you click on a task and this task has lock = 1, then do not show this baseline field else show baseline field.

Hello,
Gantt doesn’t have a built-in way to change the lightbox section visibility, but you can implement it by using the Gantt API and Javascript.

One of the ways is to change the styles of the DOM elements in the onLightbox event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onlightbox_event.html

Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/ufofv40t

Another way is to modify the lightbox sections in the onBeforeLightbox event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforelightbox_event.html

Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/kjfusgxk

Hello @ramil thank you for your answers, I like the first approach, however, with this code, instead it is hiding the start_date field, however, I have fixed it by selecting [1] elements instead.

Is it possible to add class on the baseline field on the lightbox itself, so that I could utilize that classname?

Hello,
Unfortunately, right now, there is no built-in way to do that. The dev team will add it in the future, but I cannot give you any ETA.

For now, you need to iterate the lightbox elements depending on their position in as a child of the gantt_cal_larea element.