Page 1 of 1

limit time in date time field

Posted: 05 Jan 2018
by davidnarramore
I have the following JavaScript code to limit the time selection in two date time fields called StartDate and EndDate. This was working perfectly until I upgraded to the latest forms designer version. I have tried to resave the forms, but it still doesn't work. Any help would be appreciated.

fd.field('StartDate').control()._el().find('select:eq(0) > option').filter(function() { return $(this).index() < 8 || $(this).index() > 20 }).remove()

fd.field('EndDate').control()._el().find('select:eq(0) > option').filter(function() { return $(this).index() < 8 || $(this).index() > 20 }).remove()

Re: limit time in date time field

Posted: 06 Jan 2018
by Nikita Kurguzov
Dear David,
The code works just fine for me with the latest version of Forms Designer. Let's figure out why it doesn't in your case. First thing, please make sure that the fields StartDate and EndDate have Template: Default setting, this code wouldn't work with Kendo DateTimePicker:
DefaultTemplate.png
DefaultTemplate.png (18.62 KiB) Viewed 1653 times
If the Template is set to Default, please, open the console in the browser on the form and check if it has any errors. A screenshot of the console might help us determine the reason of the error.