Server side validation of data via connector_BeforeUpdate

I need to validate the data related to a scheduled event (dhtmlxscheduler) to determine if the changes made to the event conform to a set of business rules.

I can see in the documention that you can access the data stored in the DataActionProcessingEventArgs via:

$action->get_value(‘****’); // in PHP

e.DataAction.Data[(TableField)“****”]) // in C#

which converts to:

e.DataAction.Data(DirectCast(“****”, TableField)) // in VB

However, what ever text is in the **** in the VB version, compiling throws the error "Value of type ‘String’ cannot be converted to ‘dhtmlxConnectors.TableField’.

What is the correct syntax to access the fields submitted when updating/inserting and event in the Scheduler within the connector_BeforeUpdate event?

Hi,
have you tried to conver string using CType instead of DirectCast?

e.DataAction.Data(CType("****", TableField))

or you may use TableField constructor with the same result

e.DataAction.Data(new TableField("****"))

That worked perfectly, thank you!

For extra points, can you tell me how or if the e.DataAction.SetInvalid is supposed to create a dialog box or not?

When I call it, I don’t have any feedback to the user, and the data that was original changes on the event remains invalid on the users screen.

What I need to do is, cancel the update if I deem it invalid, notify the user, and then revert the changed fields.

Perhaps I’m missing something client side to handle this.

Hi,
you may catch invalid action result using dataprocessors event(js)dp.attachEvent("onAfterUpdate", function(sid, action, tid, tag){ if (action == "invalid" || action == "error"){ //show message, rollback changes } });here is description docs.dhtmlx.com/doku.php?id=dhtm … fterupdate

in order to revert changes, you’ll need to make backup of edited event, which can de done in
“onBeforeUpdate” event of dataprocessor, or maybe in “onBeforeLightbox” of scheduler