Jump to content

Search the Community

Showing results for tags 'date'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • Caspio Apps for Ukraine
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location


Interests

  1. Hello Caspio Family, Unfortunately, Caspio doesn't have a feature that would allow validating the date before the Submission Form. The only way I found using Caspio standard features is to show a warning message when the date doesn't fit the condition (e.g. when the date should not be prior to today). You can do that with the help of rules. I will show you an example with two dates 'Start Date' and 'End Date' with conditions: the Start Date shouldn't be prior to today and the End Date should not equal or be before the Start Date. 1) Add 2 HTML blocks beneath each Date field and add a section to each HTML block 2) Inside HTML blocks we need to add some warning message in case the condition is not met 3) Create 2 Rules as on screenshots That solution will show our warning messages, but won't prevent form submission if a user disregards the warning. But if it is necessary to let users submit only correct dates, you can use the second solution with JavaScript: 1. Insert Header&Footer, HTML block 1, HTML block 2, and place them below our Date fields. No need to add extra sections. 2. In the Header enable 'Source' and paste the code:<script>document.addEventListener("BeforeFormSubmit", function (event) {startDate = document.querySelector("#InsertRecordDateStart").value;endDate = document.querySelector("#InsertRecordDateEnd").value;warn1 = document.querySelector("#warning1");warn2 = document.querySelector("#warning2");var today = new Date();var dd = String(today.getDate()).padStart(2, '0');var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!var yyyy = today.getFullYear();today = mm + '/' + dd + '/' + yyyy;if (startDate < today) {event.preventDefault();warn1.style.display = 'block'} else {warn1.style.display = 'none'}if (endDate <= startDate) {event.preventDefault();warn2.style.display = 'block'} else {warn2.style.display = 'none'}});</script> 3. In the HTML block 1 enable 'Source' and paste:<span id="warning1" style="color:#FF0000;display:none;">Start date cannot be in the past or empty</span> 4. In the HTML block 2 enable 'Source' and paste:<span id="warning2" style="color:#FF0000;display:none;">End date cannot be prior or same as Start date or empty</span> 5. Make sure your datafield 1 and datafield 2 are called 'DateStart' and 'DateEnd' respectively or in the JavaScript added to the Header you need to replace in the linesstartDate = document.querySelector("#InsertRecordDateStart").value;endDate = document.querySelector("#InsertRecordDateEnd").value;to the name of the fields you have. You can test to see how it works on my DataPages: 1st solution with Rules 2nd solution with JS
  2. Is there any way to restrict the possible date range of a calendar popup? I found a post that showed how to validate the element and show an alert, but what I'd like to be able to do is actually restrict the dates the user can select in the popup. Thanks, Andrew
  3. Hi - how can I set the my Date field in a Submission to have a default value set to the first day of the current month?
  4. Hi. I have a table holding two fields with dates I try to compare in java script. The first date is generated by caspio timestamp, and called "date_submitted", formatted like"05/15/2014 23:43:58" in the table. The second date,"Date_event_start", is a date submitted from a Caspio calendar, formatted like "05/30/2014" in the table. When i insert both dates in a HMTL block within Caspio they retur quite different. "date_submitted" returns: "05/15/2014 11:43:58 PM" and "Date_event_start" returns: "30.05.2014" Why does Caspio default output different date formats??? I want to compare the dates with a simple script like: <HTML> [@field:Late_submitted] <a id="visi[@field:ID_delegate]"> <script> var isi = document.getElementById("visi[@field:ID_delegate]"); if('[@field:date_submitted]' >= '[@field:Date_event_start]'){ isi.parentNode.parentNode.style.backgroundColor = '#FFB0AD'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#ADD8E6'; } </script> </HTML> How can i make the different date fields comparable??? --- Frode ---
  5. Hello all, I am in the middle of creating a submission form. It will have two dates: a start date and end date, both selected from a calendar. The start date is compulsory. The end date is not compulsory. When the user inputs the start date, on clicking out of the field, I need the form to check if the date is both greater to or equal to 25 April 2016, AND less than or equal to 01 May 2016. If it is incorrect, I need a message to be displayed indicating the error, and stopping the user from moving on. If the user decides to input an end date, on clicking out of the field, I need the form to check if the date is both greater to or equal to the start date, AND less than or equal to 01 May 2016. If it is incorrect, I need a message to be displayed indicating the error, and stopping the user from moving on. How can I achieve this? Thanks in advance, Julien
  6. Hello I'm a bit of a Caspio newbie and pretty unskilled (ok - very unskilled!) at Javascript. I have a couple of, hopefully small, issues that I assume I need some basic javascript to solve. I've tried adapting code that I've found elsewhere, but I don't really know what I'm doing:- 1.I have a field called 'maximum_people' and one called 'no_of_people'. I need to restrict the number of bookings received on a given date, so if I create a report datapage (filtering by date) I need to add up all the 'no_of_people' submissions, and then have the form stop if it >='maximum people'. I suppose I need something like- <script> if(SUM[@field:no_of_people] <[@field:maximum_people]) { document.write("<a href='http://b6.caspio.com/dp.asp?AppKey=504f20004a6cefd06ad94881b12c&Course_ID=[@field:Course_ID]'>Signup</a>"); } else { document.write("<p>Signup Closed</p>") } </script> 2.)The second thing is a simple block to ensure that no bookings are made before today (as the Caspio calendar allows any date to be selected, even in the past)- I guess it is sort of like- <script> if([@field:date] >="today") { document.write("<a href='http://b6.caspio.com/dp.asp?AppKey=504f20004a6cefd06ad94881b12c&Course_ID=[@field:Course_ID]'>Signup</a>"); } else { document.write("<p>Sorry, we can only take bookings from tomorrow onwards</p>") } </script> I'm flying blind though, and there are probably 101 better ways to achieve what I need. Hopefully someone can help... Duncan
  7. I have a form that has a few scripts already running in it to control some fields where I need to format numbers as currency. I'm good to go on those and they are running fine - A great big thank you to those who are posting solutions here in the forums! - It's been a great help to me and I would not be able to do some of the great things I'm accomplishing without those wonderful individuals who post solutions and code here in the forums. But I now need to control 2 date fields. I have the calendar picker set up for each field, but was hoping for the "Start Date" field, I could somehow restrict it by year, so that it would only start in 2015, and then for the "End Date" field, if there is anyway to control that so that it would only allow the date entered to be AFTER the "Start Date"? I have seen some other solutions in the forums here that refer specifically to making the dates be today or after today, but nothing with year or where a second date field is dependent on the date entered in the first or where year is the only control.... I've got to get this working soon so if anyone can help me, I would appreciate it so much! Thank you in advance!
  8. Hi, I need to store date when record was submitted. I know that I can stamp record, using a "time stamp" hidden field, but I need to store only date, month and year. I don't need time, because I'm not able to use this field in grouping data on Chart report. Thanks for help!
  9. I have a workflow that will only let a user enter a date ranging from 7 days before the current date. Obviously a calendar pop up wont work since I can't disable other choices there. So I created a task that will update the table daily and put the necessary choices that I have. This way its dynamic and I don't need to change it everyday. Here is the Task: The task above will run every day and will first delete all the existing records within the table and replace it with the new set of 7 days. An example would be. Today is May 10 here in my location and that will give me May 3 - May 10 of range. Table: DataPage: Note: You can also edit this workflow where when a date is selected that option will be removed from the Table. That will use a trigger that will delete a date when it sees it after a user submission.
  10. Hello I have two fields in my submission form - date and day. The customer selects date (via calendar pop up text field). I need the day field to automatically be populated by the day of the week from the date input (so someone inputs 25/12/2013 and the day field automatically says 'Wednesday' or whatever). Currently, I'm tackling this in a very roundabout way, by passing a long date to a report data page and then using rules (if date contains 'Monday' then hide section 1 etc). This is laborious and requires the user to click again on a url link. There must be an easier way. Does anyone know how? Ideally some javascript to just take the day of the week from the date field would be good. If that's not possible, then javascript that basically says "if [@field:date] contains 'Monday' then go to data page XXXXXXX" All help appreciated. Thanks Duncan
  11. In a table that I have, I have a date field that indicates the date an order was placed. I would like to create a calculated field in my datapage that will indicate how long it has been since the order was open (that is, the difference between today's date and the order creation date). Is there any way to do this? I know it will involve Datediff but I am unsure of how to insert today's date automatically. Ex. Order Created - 1/20/16 Today's Date - 2/12/16 The expected output would be 23. Thank you. EDIT: So I've implemented this using the following formula: DATEDIFF(day,OrderDate, GETUTCDATE()) and it works correctly but now I need this to ONLY count business days (at the moment, it is counting weekends as well). EDIT 2: I've figured it out. I will leave the answer here for posterity: To calculate the difference in dates (only considering business days), enter the following into your calculated field: select (DATEDIFF(dd,@StartDate, @EndDate)) - (DATEDIFF(ww,@StartDate, DATEADD(dd,-1,@EndDate)) * 2) - (CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 else 0 end) - (CASE WHEN DATENAME(dw, @EndDate) = 'Sunday' THEN 1 else 0 end) where you replace @StartDate and @EndDate with your corresponding fields (if you're calculating days from today, then use GETUTCDATE() for @EndDate).
  12. Hi, I have a date field in my submission form and I want to prevent the user from selecting a date that is not within a specified range of dates. Like for example, I only want the user to input dates that are within 12/01/2022 to 12/12/2022. Any dates that are not within that period will not be allowed.
  13. I want to be able to limit inline edits/inserts on a datapage. I'm trying to limit a date to dates that are after 1 week ago. Is there a way I can do this?
  14. I want a calculated field formula that can return the date in MM/DD/YYYY format. How can I get this?
  15. Hi, I'm trying to import an excel spreadsheet but it says that some dates are not compatible but upon checking the file all of the records are on the same format. Their format is dd/mm/yyyy. Do you know why I encounter this issue?
  16. I have a table which includes a timestamp and a type field (among others) I've created triggers and a view that combines this table into itself and displays a clock-in time, clock-out time, and a total time difference between them in HH:MM format. The formula in the calculated field is below: CONVERT(varchar(5), DATEADD(minute, DATEDIFF(minute, [@field:Patrol_Activity_Database_Date], [@field:Patrol_Activity_Database_1_Date]), 0), 114) My issue is that I need to have a total/aggregate for this field, but it gives an invalid error if I just do sum, and I've been unable to figure out how to get it to add the time and display it in the HH:MM format. Any help would be great!
  17. Is there a way to update a Date field to null or empty? I have a single record update DataPage and would like to set the Date field as hidden and set default value to null or empty.
  18. hello I am new to Caspio and really need a little help. I need to have my field Response updated when a date is added or changed to the field ServiceDate. The Response should be "New Date", "Updated Date" or null (if the value was not changed). ANy assistance would be greatly appreciated!!
  19. Hi, I have a simply one that I just can not figure out. I know it's easy but I haven't been able to get this to work. I have a field where the user will enter a date. I want to take that date and add one, then insert into another field on a submission form. Field Name: End Date (user entered) = 10/23/2017 Field Name: Expire Date (calculated) = 10/24/2017 Any help would be appreciated.
  20. Hi! I am trying to create 8 Date/Time fields where the user inputs Date, Hours and Minutes in separate fields. I found some JS that works on combining the input, but it only works on combining one set of the three fields to on Display Field. This is the code that I put in the Footer: <script> //Created_On_From document.getElementsByName('Submit')[0].onmouseover = function(){ var date = document.getElementById('cbParamVirtual11').value; if(date == ""){ date = "00/00/0000"; } var hour = document.getElementById('cbParamVirtual26').value; if(hour == "") { hour = "00"; } var minute = document.getElementById('cbParamVirtual27').value; if(minute == "") { minute = "00"; } document.getElementById('cbParamVirtual49').value = date + " " + hour +":"+ minute; }; </script> <script> //Created_On_To document.getElementsByName('Submit')[0].onmouseover = function(){ var date = document.getElementById('cbParamVirtual18').value; if(date == ""){ date = "00/00/0000"; } var hour = document.getElementById('cbParamVirtual33').value; if(hour == "") { hour = "00"; } var minute = document.getElementById('cbParamVirtual32').value; if(minute == "") { minute = "00"; } document.getElementById('cbParamVirtual48').value = date + " " + hour +":"+ minute; }; </script> Any help would be appreciated...
  21. Hello - I need help for custom JS to compute and display the Calibration_Due in a submission form when the user inputs the Last_Calibration date and the Calibration_Frequency · Calibration_Due = Last_Calibration + Calibration_Frequency Where field types are Calibration_Due – date Last_Calibration – date Calibration_Frequency – number of months
  22. Hello, I am new to Caspio, I encounter a problem here. I have two Tables Table#1: Investment(Investment_ID, Client_ID, Latest Transaction date, BookValue, MarketValue) e.g. Invest001|Nov 1, 2018|500|1000 Invest001|July 1, 2018|800|2000 Table#2: Investment Transaction(Investment_ID, BookValue, MarketValue, Transaction_Date) e.g in Table #1 I have following records, Invest001|100|100|Oct 1, 2018 Invest002|800|2000|July 1, 2018 Invest001|100|200|Oct 10, 2018 Invest001|100|300|Oct 15, 2018 Invest001|200|500| Sep 1, 2018 Invest001|500|1000|Nov 1, 2018 Here I would like to make the following action execute whenever I update the table. Latest Transaction Date = Table#2:Latest Investment Transaction:Transaction_Date BookValue = Table#2:Latest Investment Transaction: BookValue MarketValue = Table#2:Latest Investment Transaction: MarketValue What can I do to make this happen? Any help will be appreciated, Thank you very much in advance,
  23. Hello all; I am trying to log the time users are logged in, and I am unable to get any precision. I would like hours to be displayed with two decimal places of accurate precision, but Datediff rounds to the nearest unit of time. This (IMO) should be fairly easy to overcome by using a smaller unit of time, and dividing that large number by 60 or 3600 (for minute or second), but no luck. Using the following sessions let's look at what I want, what I've tried, and what I'm getting. SessionID = 1 | LoginDT 8-17-2014 09:00:00 | LogoutDT 8-17-2014 09:15:00 SessionID = 2 | LoginDT 8-17-2014 10:00:00 | LogoutDT 8-17-2014 10:40:00 SessionID = 3 | LoginDT 8-17-2014 11:00:00 | LogoutDT 8-17-2014 13:30:00 Desired Result: SessionID = 1 | Logged Hours 0.25 SessionID = 2 | Logged Hours 0.67 SessionID = 3 | Logged Hours 2.50 Datediff(hour,[@field:LoginDT],[@field:LogoutDT]) SessionID = 1 | Logged Hours 0.00 SessionID = 2 | Logged Hours 0.00 SessionID = 3 | Logged Hours 2.00 Datediff(minute,[@field:LoginDT],[@field:LogoutDT]) SessionID = 1 | Logged Hours 15.00 SessionID = 2 | Logged Hours 40.00 SessionID = 3 | Logged Hours 150.00 Datediff(minute,[@field:LoginDT],[@field:LogoutDT])/60 SessionID = 1 | Logged Hours 0.00 SessionID = 2 | Logged Hours 0.00 SessionID = 3 | Logged Hours 2.00 (Datediff(minute,[@field:LoginDT],[@field:LogoutDT]))/60 SessionID = 1 | Logged Hours 0.00 SessionID = 2 | Logged Hours 0.00 SessionID = 3 | Logged Hours 2.00 Round(Datediff(minute,[@field:LoginDT],[@field:LogoutDT])/60,2) SessionID = 1 | Logged Hours 0.00 SessionID = 2 | Logged Hours 0.00 SessionID = 3 | Logged Hours 2.00 Round((Datediff(minute,[@field:LoginDT],[@field:LogoutDT]))/60,2) SessionID = 1 | Logged Hours 0.00 SessionID = 2 | Logged Hours 0.00 SessionID = 3 | Logged Hours 2.00 Any ideas? Thanks!
  24. Years ago I added some JavaScript to my forms to prevent clients from selecting a "due date" that isn't at least two weeks in the future. Recently that code has stopped working, and all submissions are allowed through, regardless of the date selected. I think this may be tied to the recent Caspio updates. At least, that's all that I can see; the forms themselves haven't changed. Below I'm pasting my JS, which resides in the footer area of my forms. Any ideas would be greatly appreciated. Thanks! (BTW, I know two weeks is 14 days, not 13. But my users don't seem to recognize that, so I made this small allowance.) <SCRIPT LANGUAGE="JavaScript"> function check_date() { var entered_value = document.getElementById("InsertRecorddateNeeded").value; var entered_date = new Date(entered_value); var two_week_date = new Date(); two_week_date.setDate(two_week_date.getDate() + 13); if(entered_date < two_week_date) { alert("Must be at least 2 weeks in future"); return false; } } document.getElementById("caspioform").onsubmit=check_date; </SCRIPT>
  25. Hi there I would like to know if there is a way of changing the date format in a table from MM/DD/YY to DD/MM/YY I have changed region settings but the date format stays the same. I have been able to change the format on the datapage but have found no way of changing it on the table. Does anybody know if this is possible?
×
×
  • Create New...