- Home
- Forum
- React - EJ 2
- Custom Validation editor template fields
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; }} >
</DropDownListComponent>
</td></tr>
<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; }} >
</DropDownListComponent>
</td></tr>
<tr>
<td className="e-textlabel">From</td><td style={{ colspan: '' }}>
<DateTimePickerComponent id="startDateTime" className="e-start e-field" min={new Date} ></DateTimePickerComponent>
</td>
</tr>
<tr><td className="e-textlabel">To</td><td style={{ colspan: '4' }}>
<DateTimePickerComponent id="stopDateTime" className="e-end e-field" min={new Date}></DateTimePickerComponent>
</td></tr>
<tr><td className="e-textlabel"></td><td style={{ colspan: '4' }}>
<div>
<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
</Label>
</FormGroup>
<FormGroup check>
<Label check>
<input type="radio" ref={(value)=>{this.reqType = value}} name="rdRequestType" value="1" onChange={this.handleRadio} />
{' '}
Repeating Request
</Label>
</FormGroup>
</div>
</td></tr>
<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>
</td></tr>
<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>
</td></tr>
</tbody></table>
<FormGroup check row>
<Button type="button" id="Calculate_cost_btn"className="btn btn-link CalculateCost_btn">Calculate Cost </Button>
</FormGroup>
</div>);
}
<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),
}}
editorTemplate={this.editorTemplate}
popupOpen={this.onPopupOpen.bind(this)}
cellDoubleClick={this.cellDoubleClick.bind(this)}
renderCell={this.onRenderCell.bind(this)}
allowDragAndDrop={true}
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]} />
</ScheduleComponent>
Thankjs,
Pavan
SIGN IN To post a reply.
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.
Regards,
Karthigeyan
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
PK Pavan Kumar
- Jan 11, 2019 07:59 PM UTC
- Feb 13, 2019 10:18 AM UTC