Popup as alert message


Before saving a lightbox I need to validate the data entered and generate an error. I would like to have this with the same L&F that the component.

Is it possilbe? I would like to have something similar to the delete dialog after clicking the delete button.


I found in the documentation the option to do something similar with dhtmlx.message({type:"error", text:"Enter task description!"}); but this is showing the message in the upper right corner, similar to the assert option.

I also tested http://docs.dhtmlx.com/gantt/samples/05_lightbox/03_validation.html and got the same result.

you can listen to onLightboxSave and onLightboxDelete events, they are fired when user clicks a related lightbox button:

docs.dhtmlx.com/gantt/api__gantt … event.html
docs.dhtmlx.com/gantt/api__gantt … event.html

Messages are displayed via dhtmlxMessage library, that is integrated into the gantt component. You can customize the popup appearence and use different types of popups - info(as in sample), alerts or confirms




I thing you haven’t read my last message, as I already tried and didn’t work properly. I provided a like to your documentation that doesn’t work either.

This is an expected look of the dhtmlxMessage info popup (can see one on the github demo page dhtmlx.github.io/message/ ), which is used in the examples, and also for error messages.

Position of the popup, as well as style can be configured, in case you need something specific
docs.dhtmlx.com/doku.php?id=dhtm … ositioning
docs.dhtmlx.com/doku.php?id=dhtm … on#styling

And you can use different modes of a popup - alert, or confirm
docs.dhtmlx.com/doku.php?id=dhtm … ge:confirm

Skin of a gantt is applied to popups, so they will look slight differently from samples in dhtmlx docs

Can you try http://docs.dhtmlx.com/gantt/samples/05_lightbox/03_validation.html and then edit any task and remove the task description. Then click Save.

When I did it I got the attached file as a result. Is this how the message work?

Exactly. I believe you could see it in the github demo or in docs that i’ve sent before)

[code]//shows red message at top right. This is used in most of our examples
type:“error”, //predefined type for red messages that appears on top-right
text:“Enter task description!”

type:“info”, //top right, white bg
text:“Enter task description!”

//or you can use alerts, that appears at the center of the screen
text: “Enter task description!”,
callback: function() {dhtmlx.alert(“Test alert”);}

//or confirms
text: “Are you sure?”,
callback: function(res) { if(res){}else{} }

Please check the demo, at the bottom of the page there several buttons that demonstrates pretty much all functionality that is availabe with built-in popups

Understood, thanks.