Appointment Field Validation not working

Hi,

I tried appointment field validation as documented in this link. Below shows my code snippet :
$appointments = new AppointmentSetting();
$appointments->dataSource($data)
->id('id')
->subject(json_decode('{"field":"subject","validationRules":{"required":true}}',true)) // Subject field validation
->startTime('start_time')->endTime('end_time')
->allDay('all_day')->description('description')->recurrence('recurrence');

$calendar = new Schedule('appointments-calendar');
$calendar->width('100%')->height('500px')
->currentDate(now())->appointmentSettings($appointments)->views(['Month'])
->showAppointmentNavigator(false)
->showTimeZoneFields(false)
->dateFormat('yyyy-MM-dd')
->firstDayOfWeek('Monday');
But I got no any validation errors in the event window or quick window submission. It keeps accepting empty subject field.

Here is the rendered script of the above php code:

$('#appointments-calendar').ejSchedule({
"width": "100%",
"height": "500px",
"currentDate": new Date(1609910253000),
"appointmentSettings": {
"dataSource": [
          // datasource here ..
        ],
"id": "id",
"subject": {"field": "subject", "validationRules": {"required": true}},
"startTime": "start_time",
"endTime": "end_time",
"allDay": "all_day",
"description": "description",
"recurrence": "recurrence"
},
"views": ["Month"],
"showAppointmentNavigator": false,
"showTimeZoneFields": false,
"dateFormat": "yyyy-MM-dd",
"firstDayOfWeek": "Monday"
});
But once I compare the above script with the script given in this example, I just figured out few changes in the code. Unlike the rendered script, fields are defined in the separate fields object like below :
eventSettings: {
dataSource: data,
fields: {
subject: {name: 'subject', validation: {required: true}},
},
....
},
I would appreciate any help or suggestions to solve this problem.


2 Replies 1 reply marked as answer

BS Balasubramanian Sattanathan Syncfusion Team January 7, 2021 10:17 AM UTC

Hi Shanaka, 

Thanks for contacting Syncfusion Support. 

We have validated your requirement at our end and suggest you to refer and follow the below sample. In the below sample, we have added validation for the Subject field.  


Kindly refer and try to the above sample, let us know if you need further assistance. 

Regards, 
Balasubramanian S 


Marked as answer

SI Sim January 30, 2023 09:54 AM UTC

The Appointment Field Validation feature in Syncfusion is a great way to ensure that data is entered correctly and accurately. It helps to prevent errors from occurring when entering data into the system. However, if the validation is not working properly, there are a few steps that can be taken to troubleshoot the issue. First, check to ensure the validation rules are set up correctly. If the rules are not set up properly, the validation will not work. Additionally, ensure that the data being entered is valid according to the validation rules. If the data is not valid, the validation will not work. Finally, check to ensure the validation is enabled in the system. If it is not enabled, the validation will not work. If all of these steps are taken, and the validation is still not working, it may be necessary to contact Syncfusion support for further assistance.


Loader.
Up arrow icon