We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom validation with popup confirmation before adding an appointment

Thread ID:

Created:

Updated:

Platform:

Replies:

146337 Jul 31,2019 08:03 PM UTC Apr 21,2020 06:22 AM UTC Angular - EJ 2 3
loading
Tags: Schedule
Robert
Asked On July 31, 2019 08:03 PM UTC

I need to do a validation outside of the typical ones built into the scheduler's editor. I've tried setting it inside the onActionBegin and onActionComplete to fire before allowing the event to actually finish with no luck.

How can I intercept the onActionBegin/onActionComplete events before the scheduler actually attempts to save the appointment? Also, is there a way to customize the editor's save button so it doesn't automatically save before this custom validation I have?

Karthigeyan Krishnamurthi [Syncfusion]
Replied On August 1, 2019 09:18 AM UTC

Hi Robert 
 
Syncfusion greetings. 
 
By default, Scheduler supports validation on save button click and kindly refer the below links. 
 
Alternatively validation can be performed using actionBegin and actionComplete events. In the below sample, when a save button is clicked without value in Title field, editor will not close and alert will be displayed. 
 
onActionBegin(args: ActionEventArgs): void { 
    if (args.requestType === "eventCreate" && args.data[0].Subject === "Add title" && !isNullOrUndefined(document.querySelector('.e-schedule-dialog'))) { 
      this.scheduleObj.uiStateValues.isBlock = true; 
      args.cancel = true; 
      alert('Enter Title'); 
    } 
  } 
  onActionComplete(args: ActionEventArgs): void { 
    if (!isNullOrUndefined(document.querySelector('.e-schedule-dialog'))) { 
      let diaObj = (document.querySelector('.e-schedule-dialog') as EJ2Instance).ej2_instances[0] as any; 
      this.scheduleObj.uiStateValues.isBlock = false; 
      diaObj.hide(); 
    } 
  } 
 
Regards, 
Karthi 
 


Ola Ekdahl
Replied On April 20, 2020 05:12 PM UTC

Hi Karthi,
I'm trying to do the same thing but I don't think your Stackblitz example is working as described. The editor window is still closing before the alert is shown. Is there a way to keep the the Editor open until validation in on ActionBegin is done?

Vengatesh Maniraj [Syncfusion]
Replied On April 21, 2020 06:22 AM UTC

Hi Ola Ekdahl, 

Greetings from Syncfusion Support. 

We have checked our sample which is provided in the last update and the sample is to validate the field from the editor window. And also we have checked your reported problem with that sample and we suspect that your requirement is to validate the field from the quick popup and keep open the window after close the alert. So we have achieved your requirement by making use of popupClose event. This event will help us to validate the fields before saving and keep opening.  

onPopupClose(args): void { 
    if (args.type === "QuickInfo" && (this.scheduleObj.quickPopup as any).isCrudAction && (args.data as any).Subject === "Add title") { 
      args.cancel = true; 
      alert('Enter Title'); 
    } 
    if (args.type === "Editor" && (this.scheduleObj.eventWindow as any).isCrudAction && (args.data as any).Subject === "Add title") { 
      args.cancel = true; 
      alert('Enter Title'); 
    } 
  } 


Kindly check the above sample and get back to us if you need any further assistance. 

Note: Kindly use our latest packages to get the popupClose event 

Regards, 
Vengatesh 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon