When user tries to performs event mangment action like double click or dragging, trying to add event or to delete other, how is it possible to check the validity of the request (If the user is eligble to make the change)? How is it possible to verify the data (event name must not be more than 10 letters)? How is it possible or recommended to display error message?
Is it possible to do it on client side (using Javascript?) or only on server side (with Asp.Net C# WebForms)? Please confine the answer to only one of the above methodologies.
Hello,
the validation can be performed quite easily on the client-side
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … event.html
The server-side validation is bit more difficult, since the client-side API events do not support async handlers (supposedly, you were going to do an ajax call for validation). In this case you’ll have to do some workaround, for example - You can return false from the event to block the change but preserve values, and if you have a confirmation from the server you can reapply changes through API.
in order to display error messages, you can use dhtmlxMessage library. It’s already embedded in the client-side component so you don’t need to add any additional libraries
It can be used as
dhtmlx.message("Message text");
dhtmlx.alert("text");
More details at dhtmlx.github.io/message/
Most of events editing rights are based on data within the database. Is it true that in such case it is necessary to use server side validation? Is it possible to block event editing by changing event property (something like setting editable=false)?
Most of events editing rights are based on data within the database. Is it true that in such case it is necessary to use server side validation?
If it’s possible to make some of this data available on the client-side, you can do validation on the client with additional checking on the server side during saving of changes (i.e. in ‘SaveAction’ handler). Usually it’s possible if the rights are not likely to be changed during user session. So in most cases if item passes the client side validation it will pass validation on server. If it’s not - it mean client-side rights are not longer valid, and you can trigger reloading the data.
Invalid operation flag can be set to the DataAction object-
C#:var action = new DataAction(actionValues);
action.Type = DataActionTypes.Error;
//and optionally message:
action.Message = "Message";
Then such action result can be captured on the clientscheduler.dataProcessor.attachEvent("onAfterUpdate", function(id, action, tid, response){
if(action == "error"){
dhtmlx.alert({
text: tag.text || tag.textContent,//message
});
}
});
Note that at the point when onAfterUpdate if fired, all changes are applied on the client side. So you either need to return a correct values of an event from the server
scheduler-net.com/docs/managing- … the_server
or simply reload the data. All of this won’t require any operations during the validation - you checking event on the client, if it’s passed - client side applies changes and sends update to the server. If server confirms - operation is finished, if not - you somehow handle it.
However, if non of this is possible in your application - you’ll have to do workaround with ajax validation, as i described in previous post
Regarding the ‘editable’ flag, scheduler has no built in support for such items. But if you add such property to the data, you’ll be able access it with a client side API and block editing for such events
docs.dhtmlx.com/scheduler/api__s … event.html
docs.dhtmlx.com/scheduler/api__s … event.html