Cameron Posted September 15, 2015 Report Share Posted September 15, 2015 Hi everyone, I have found several scripts that do not allow to submit the data if the date is too late (or too early). Is it possible to deny to enter the data, if time is too late? I mean, if the data may be added only before 10 AM, and now is 11 AM, then the data is not added and some error message is displayed? Or more simple script, if the data may be added only before 10 AM, and a user tries to enter "11 AM", then the data is not added and some error message is displayed? Thank you for your time! Quote Link to comment Share on other sites More sharing options...
Aurora Posted September 16, 2015 Report Share Posted September 16, 2015 Hey Cameron ! How are you today ? Here is a script which might help you : <script> var v_name = document.getElementById('InsertRecordFirst_Name'); var v_surname=document.getElementById('InsertRecordLast_Name'); var v_date = document.getElementById('InsertRecordDate_Field'); var v_submitRow = document.getElementById('Submit').parentNode.parentNode; if(new Date().getHours() >= 10 ){ alert(' TOO LATE, SORRY !! YOU CAN ONLY SUBMIT YOUR DATA TILL 10:00 ') v_name.disabled = true; v_surname.disabled = true; v_date.disabled = true; v_submitRow.style.display = 'none'; } </script> Best , Aurora Quote Link to comment Share on other sites More sharing options...
ChrisCarlson Posted November 6, 2015 Report Share Posted November 6, 2015 How can I modify this script to allow user to enter a previous date no more than 10 days ago and no future date? Quote Link to comment Share on other sites More sharing options...
aam82 Posted November 6, 2015 Report Share Posted November 6, 2015 you can create a table of all dates in the calendar year. then a view of that table, with the following criteria: date = today or date within last 10 days then use this view as the dropdown for the datepicker on your form Quote Link to comment Share on other sites More sharing options...
Xiang Posted November 23, 2015 Report Share Posted November 23, 2015 Hi ccarls3, I've posted a script, I think, it can help: http://forums.caspio.com/index.php/topic/5341-validate-past-and-future-dates/ I'll be grateful, if you tell me if the code works.Have a nice day! 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.