edujobs2k18 Posted September 4, 2018 Report Share Posted September 4, 2018 How to block user to choose Past or Future date in submission form? Like i have a "Date0" field in a submission form. I want to block user to choose future date from calendar pop-up. Also does if user choose hour from dropdown element new date will automatically take. Can anyone help me? Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted September 6, 2018 Report Share Posted September 6, 2018 Hi there! Quote Link to comment Share on other sites More sharing options...
Kurumi Posted February 19, 2022 Report Share Posted February 19, 2022 Hi - this new post might help: Quote Link to comment Share on other sites More sharing options...
PotatoMato Posted September 30, 2022 Report Share Posted September 30, 2022 Hi! Just to update this post, you may check this link: https://devnote.in/how-to-disable-previous-dates-in-date-picker-using-jquery/. Just disable the 'Calendar Pop Up' on your date field and change the 'date_picker' to your field name: -Potato Quote Link to comment Share on other sites More sharing options...
Kurumi Posted October 21, 2022 Report Share Posted October 21, 2022 Hi! - Just wanted to share this solution. If you want to save and restrict/disable Date. You may use an external JS library called flatpickr: https://flatpickr.js.org/getting-started/ To apply in the DataPage, follow these steps: 1. Insert Header and Footer. In the Footer, insert the code below. Make sure to disable first the HTML Editor in the Advanced Tab. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> <!-- jQuery --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!-- Flatpickr --> <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> <script> $("#InsertRecordAppointment").flatpickr({ dateFormat: "d/m/Y", altInput: true, altFormat: "m/d/Y", disable: [ { from: "26-10-2022", to: "31-10-2022" } ] }); </script> Optional: You can insert this Style/CSS in the Header to change the font based on your DataPage's style. <style> .flatpickr-calendar { font-family: system-ui !important; } </style> To know the formats, you can check them here: https://flatpickr.js.org/formatting/ enableTime - you are enabling time to the pickerdateFormat - format of the date that will be saved in the table. Caspio only accepts MM/DD/YYYY format in the table.disable: range of date that you would like to disable - format will be based on the the dateFormat If you want to have a different display in the Text Field when selecting Date and Time, you can add altInput. altInput hides your original input and creates a new one. Upon date selection, the original input will contain a m/d/Y H:i string, while the altInput will display the date in a more legible, customizable format. Example: $("#DATETIMEFIELD").flatpickr({ enableTime: true, dateFormat: "m/d/Y H:i", altInput: true, altFormat: "F j, Y H:i" }); IMPORTANT Note: Uncheck the Calendar pop-up in the field to apply the flatpickr. Result: Quote Link to comment Share on other sites More sharing options...
PotatoMato Posted June 9 Report Share Posted June 9 Hi! Just to update, Caspio has added an article to disable past or future dates: https://howto.caspio.com/tech-tips-and-articles/disabling-past-or-future-dates-in-calendar/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.