datetime validation

Avatar

Avatar

beginner_398712

Avatar

beginner_398712

beginner_398712

15-10-2015


Hello


I have a in a dialog two datetime fields, start and end datetime.
I want to validate that the startdate < enddate, but I couldn't find anyway to do this with the api.
I tried to use the change event but it is only fired when the dialog is coming up and when you press ok, not when you actually change a value on the field. I also tried some of the other events but none of them when you actually change a data or a time.
I also tried to replace this component with two component a datefield and a timefield because they provide the possibility to define a validator but you only get the value and not access to the component so I cannot compare the two fields.
I found another solution on the web about using the beforerender event to setup the min max values but again this event is only fired once at the begining
this is how the code looks like

                    <date                         jcr:primaryType="cq:Widget"                         collapsed="{Boolean}false"                         collapsible="{Boolean}false"                         itemId="date"                         title="Date"                         xtype="dialogfieldset">                         <items jcr:primaryType="cq:WidgetCollection">                             <eventScheduledStartDate                                 jcr:primaryType="cq:Widget"                                 allowBlank="{Boolean}false"                                 fieldLabel="Scheduled start for"                                 ignoreData="false"                                 itemId="eventScheduledStartDate"                                 name="./cs_17585:eventScheduledStartDate"                                 tooltip="Define the scheduled start date and time for the event"                                 xtype="datetime"/>                             <eventScheduledEndDate                                 jcr:primaryType="cq:Widget"                                 fieldLabel="Scheduled end for"                                 ignoreData="false"                                 itemId="eventScheduledEndDate"                                 name="./cs_17585:eventScheduledEndDate"                                 tooltip="Define the scheduled end date and time for the event"                                 xtype="datetime"/>                                                            </eventScheduledEndDate>                         </items>                     </date>  

Accepted Solutions (0)

Answers (0)