Custom elements in lightbox don't get returned on save?

Hello,

I have a lightbox with custom select and radio elements.

Apparently it all works fine, whatever I have in the grid appears correctly on lightbox open, and any changes in the lightbox get updated in the grid.

But now I need to catch the onLightboxSave event to perform validations, and the custom fields aren’t there.

An example:

gantt.attachEvent(“onLightboxSave”, function(id){
var task = gantt.getTask(id);
if (!task.worker) { // --> task object doesn’t have a worker key
alert(“The worker field is mandatory. Please try again”);
return false;
}

I must be missing something, can you help me out?

Thanks in advance!

Hello,
Could you clarify if you use the default lightbox with custom elements or you have a custom lightbox with custom elements?
onLightboxSave fires only for the default Lightbox when you click on the “Save” button.

Here is an example with the standard lightbox and controls validation:
http://snippet.dhtmlx.com/951c816cc
And here is another example where you can remove task text and the task won’t be saved until you add the task text:
http://snippet.dhtmlx.com/1330aafd7

Maybe when you check if the option is selected, there is task.worker property but it is "" or something else that makes Javascript think that it is valid.
You can try editing the snippets above and reproduce the issue there. And I will see what might be wrong.

Hi Ramil,

Nevermind, I went back to the code to build a snippet for you and all the custom task fields are there, I was doing something wrong for sure.

Apologies for wasting your time.