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. Image for the cookie policy date

Custom Validation editor template fields

Hello Syncfusion,

I would like to diplay custom validation message on Event popup. I have setup Validation:{required:true} for fields however i do have set of conditions for fields to match. If it doesn't match the conditions i would like to display validation message on same popup. 

1. Editor template doesn't check whether starttime is less than endtime. 
2. Editor template doesn't check whether repeat request on weekly doesn't check days selected falls under selected time range.
3. display custom error message on popup.

Below is my editor template  and schedule component

editorTemplate(props) {
return( <div> <table className="custom-event-editor" style={{ width: '100%', cellpadding: '5' }}><tbody>
<tr><td className="e-textlabel">Tenant</td><td style={{ colspan: '4' }}>
<DropDownListComponent id="tenantName" placeholder='Choose Tenant' className="e-field" style={{ width: '100%' }} dataSource={this.props.Tenant_List_Response.TenantsList} fields={this.tenant_dropdown_fields}
change={this.LoadTenantZones} ref={(dropdownlist) => { this.tenantObj = dropdownlist; }} >

<tr><td className="e-textlabel">Place</td><td style={{ colspan: '4' }}>
<DropDownListComponent id="zoneId" placeholder='Choose place' className="e-field" style={{ width: '100%' }} dataSource={this.props.Tenant_ZoneList_Response} fields={this.zones_dropdown_fields}
enabled={false} ref={(dropdownlist) => { this.zoneObj = dropdownlist; }} >
<td className="e-textlabel">From</td><td style={{ colspan: '' }}>
<DateTimePickerComponent id="startDateTime" className="e-start e-field" min={new Date} ></DateTimePickerComponent>
<tr><td className="e-textlabel">To</td><td style={{ colspan: '4' }}>
<DateTimePickerComponent id="stopDateTime" className="e-end e-field" min={new Date}></DateTimePickerComponent>

<tr><td className="e-textlabel"></td><td style={{ colspan: '4' }}>
<FormGroup check >
<Label check>
<input type="radio" ref={(value)=>{this.reqType = value}} id="reqtype" value="0" name="rdRequestType" defaultChecked="true" value="0" onChange={this.handleRadio} />
{' '}
Single Request
<FormGroup check>
<Label check>
<input type="radio" ref={(value)=>{this.reqType = value}} name="rdRequestType" value="1" onChange={this.handleRadio} />
{' '}
Repeating Request
<tr className="repeat_row" ref={t => this.recCompleteObject = t} ><td className="e-textlabel"></td><td style={{ colspan: '4' }}>
<RecurrenceEditorComponent id='RecurrenceRule' ref={t => this.recObject = t} frequencies ={['weekly']} change={this.onChange.bind(this)}></RecurrenceEditorComponent>
<tr><td className="e-textlabel">Comments</td><td style={{ colspan: '4' }}>
<textarea id="createdBy" ref={t => this.commentObj = t} className="e-field e-input" name="createdBy" rows={3} cols={50} style={{ width: '100%', height: '60px !important', resize: 'vertical' }}></textarea>
<FormGroup check row>
<Button type="button" id="Calculate_cost_btn"className="btn btn-link CalculateCost_btn">Calculate Cost </Button>

<ScheduleComponent width='100%' height='755px' cssClass='schedule-date-header-template' timezone='UTC' showHeaderBar={true} showQuickInfo= {false} currentView='Month' ref={t => this.scheduleObj = t} eventSettings={{
dataSource: filtered_data_update,
fields: { id: 'requestId', subject: { name: 'tenantName' }, location: { name: 'zoneName' }, description: { name: 'createdBy'}, startTime: { name: 'startDateTime', validation:{required :true} }, endTime: { name: 'stopDateTime', validation:{required :true} }, RecurrenceRule: { name: 'RecurrenceRule' },zoneId: { name: 'zoneId' } },
enableTooltip: true,
tooltipTemplate: this.template.bind(this),
eventRendered={this.onEventRendered.bind(this)} actionBegin={this.onActionBegin.bind(this)} actionComplete={this.onActionComplete.bind(this)}
// saveEvent={this.onSaveEvent.bind(this)}
// addEvent={this.onCreation.bind(this)}
<Inject services={[Day, Week, WorkWeek, Month, Agenda, Resize, DragAndDrop]} />


1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team February 13, 2019 10:18 AM UTC

Thank you for contacting Syncfusion support. 
We have prepared the below custom editor sample for all your requirements. 

Live Chat Icon For mobile
Up arrow icon