ababcock
Caspio Ninja-
Posts
52 -
Joined
-
Last visited
Recent Profile Visitors
913 profile views
ababcock's Achievements
Newbie (1/14)
1
Reputation
-
I have a details page where users edit their time sheets entries. It shows the original times entered and has fields for new times. It was working fine, but now it is not updating. They click the update button, but it doesn't record any of their new data. I looked at the page with the Developer View on Chrome, and it shows this error: "Uncaught TypeError: Cannot set property 'onmouseover' of null" I will paste the footer script below. Please help me figure out what's wrong with it! <script> document.getElementById('Mod0EditRecord').onmouseover = function(){ var date = document.getElementById('EditRecordDate').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual1').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual2').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual3').value; document.getElementById('EditRecordStart_Time').value = date + " " + hour + ":" + minute + " " + ampm; var hour2 = document.getElementById('cbParamVirtual4').value; if(hour2 =="") hour2="00"; var minute2 = document.getElementById('cbParamVirtual5').value; if(minute2 == "") minute2 = "00"; var ampm2 = document.getElementById('cbParamVirtual6').value; document.getElementById('EditRecordEnd_Time').value = date + " " + hour2 + ":" + minute2 + " " + ampm2; var start= new Date(document.getElementById('EditRecordStart_Time').value); var end = new Date(document.getElementById('EditRecordEnd_Time').value); var timeDiff = end - start; var hh = Math.floor(timeDiff / 1000 / 60 / 60); timeDiff -= hh * 1000 * 60 * 60; var mm = Math.floor(timeDiff / 1000 / 60); var totalmin= (mm+ (hh * 60)) ; document.getElementById('EditRecordHours').value = (totalmin/60).toFixed(2); }; </script>
-
I have users that enter non-time entries in time fields, and I can't figure out how to block that. The most common errors are using the wrong punctuation (semi-colon or period instead of colon) and putting letters in (o instead of 0). I also have trouble with users entering the wrong AM/PM designation, resulting in totals of negative hours or hours over 12. Does anyone have suggestions? I have used text fields for time as well as the Caspio solution where you use multiple virtual fields to break down the parts of the time. The text field is easier, but I can do it either way. I have tapped out Caspio chat on this one, so I'm hoping someone here can help!
-
I have a time sheet submission page where users enter their start and end times, and the system calculates their total hours. I'm trying to find a way to block them from entering spans of time greater than 12 hours (or hours less than 0) because this is usually an error in AM/PM selection. I'm hoping to have a pop-up that tells them there is an error they need to fix before they can submit it. Is there a way to do this? Below is what I have in my footer to calculate the time: <script> document.getElementById('Submit').onmouseover = function(){ var date = document.getElementById('InsertRecordDate').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual1').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual2').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual3').value; document.getElementById('InsertRecordStart_Time').value = date + " " + hour + ":" + minute + " " + ampm; var hour2 = document.getElementById('cbParamVirtual4').value; if(hour2 =="") hour2="00"; var minute2 = document.getElementById('cbParamVirtual5').value; if(minute2 == "") minute2 = "00"; var ampm2 = document.getElementById('cbParamVirtual6').value; document.getElementById('InsertRecordEnd_Time').value = date + " " + hour2 + ":" + minute2 + " " + ampm2; var start= new Date(document.getElementById('InsertRecordStart_Time').value); var end = new Date(document.getElementById('InsertRecordEnd_Time').value); var timeDiff = end - start; var hh = Math.floor(timeDiff / 1000 / 60 / 60); timeDiff -= hh * 1000 * 60 * 60; var mm = Math.floor(timeDiff / 1000 / 60); var totalmin= (mm+ (hh * 60)) ; document.getElementById('InsertRecordHours').value = (totalmin/60).toFixed(2); }; </script>
-
I would also like to block negative amounts of time, for the reverse of this issue.
-
I have a time sheet submission page where users enter their start and end times, and the system calculates their total hours. I'm trying to find a way to block them from entering spans of time greater than 12 hours because this is usually an error in AM/PM selection. I'm hoping to have a pop-up that tells them there is an error they need to fix before they can submit it. Is there a way to do this? Below is what I have in my footer to calculate the time: <script> document.getElementById('Submit').onmouseover = function(){ var date = document.getElementById('InsertRecordDate').value; if(date == "") date = "1/1/2011"; var hour = document.getElementById('cbParamVirtual1').value; if(hour =="") hour="00"; var minute = document.getElementById('cbParamVirtual2').value; if(minute == "") minute = "00"; var ampm = document.getElementById('cbParamVirtual3').value; document.getElementById('InsertRecordStart_Time').value = date + " " + hour + ":" + minute + " " + ampm; var hour2 = document.getElementById('cbParamVirtual4').value; if(hour2 =="") hour2="00"; var minute2 = document.getElementById('cbParamVirtual5').value; if(minute2 == "") minute2 = "00"; var ampm2 = document.getElementById('cbParamVirtual6').value; document.getElementById('InsertRecordEnd_Time').value = date + " " + hour2 + ":" + minute2 + " " + ampm2; var start= new Date(document.getElementById('InsertRecordStart_Time').value); var end = new Date(document.getElementById('InsertRecordEnd_Time').value); var timeDiff = end - start; var hh = Math.floor(timeDiff / 1000 / 60 / 60); timeDiff -= hh * 1000 * 60 * 60; var mm = Math.floor(timeDiff / 1000 / 60); var totalmin= (mm+ (hh * 60)) ; document.getElementById('InsertRecordHours').value = (totalmin/60).toFixed(2); }; </script>
-
Sorry, I re-posted the first response initially as my response. Your solution worked, problem solved, thank you! Amanda
-
ababcock reacted to a post in a topic: Word Count
-
That worked; thanks so much for your help! Amanda
-
Thank you! This worked on the first field, but when I added an HTML block to count the words in a second field (and updated the field name), it's not working for the second field. The first one still works. Is there a trick to getting it to work twice? Thanks again! Amanda
-
I'm looking for a way to show the WORD COUNT, rather than character count, in a text area. I found a script to do it, but it was not Caspio-specific and involved creating another text area. I'm hoping to find a way to do this within Caspio. Any ideas?
-
I am trying to figure out a way to freeze the actual header on a results page. I know how to freeze the header row (the titles of each column), but I'm talking about the HTML Header above all of that. I have inserted info into this that I would like to scroll with the user as they go down the page. Is this possible?
-
I am also trying to pass a Virtual Field to a saved field. I need to save Virtual3 (which is a cascading field) to a text area field, which is PCP_Diagnosis. It is on a submission form, and I'm having trouble figuring it out. I tried pulling from another submission page I had help creating, but it's not working. Here is what I have: <script> function changeVal() { setTimeout(function(){ { document.getElementById('InsertRecordPCP_Diagnosis').value = document.getElementsByName('cbParamVirtual3')[0].textContent;} else { document.getElementById('InsertRecordPCP_Diagnosis').value ="";} }; </script> I would use the script you posted, but I'm not sure what to replace the k_suppliermark part with. Any help is very much appreciated!!
-
I am trying to create a log book that calculates hours. I have a submission form now that uses javascript to calculate hours based on a start time and end time, but I don't know how to expand that to multiple times. How can I re-write the javascript to apply to multiple start/end times? And can I make it ignore blank fields? Thanks for your help!
-
I am trying to create a dashboard. I have several datapages, mostly search and reports where the search criteria is predetermined, that I would like to display on one page. I'm hoping to do this in a table, so that users can scroll down within each page, rather than having each one take up a lot of space. I know how to create a table on my end, and I can paste the embed code within it, but when I do, it makes the table adjust to the size of the datapage, resulting in a much wider table than I would like. I think the Styles settings on Caspio don't apply when you use the embed code, so I have tried adjusting my CSS stylesheet, but I'm still not able to affect how wide it is. I have been able to move the whole thing to the right using left-margin, and I can change the background color, but the overall width remains the same. Also, I would like to be able to adjust the height of each row in the table so that users have to scroll within the "cell" rather than having a web page that is really long. I can adjust this a little by editing the datapage to only show 5 or 6 results at a time, but adjusting the height would be much simpler for me. Does anyone have suggestions? Thank you!
-
I am trying to create a button that connects users to a details page depending on their access level. Here is what I have in the button right now (URL changed): <input onclick="window.open('https://sample.org/edit.html?ID=[@field:Contact_Sheet_Number]')" type="button" value="Edit Content" /> I would like to adjust that so it directs - user level users to one page: https://sample.org/edit.html - management level users to one page: https://sample.org/edit1.html - admin level users to one page: https://sample.org/edit2.html I was directed to this page for help: http://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/ which explains redirect after login based on access level, but I was wondering if I could just insert the HTML code into the HTML box my button is in (rather than a standalone login screen). Here is the code they recommend: <script> if("[@authfield:Admin]" == "Yes"){ window.location = "http://www.mysite.com/admin.html"; } else if ("[@authfield:Manager]" == "Yes"){ window.location = "http://www.mysite.com/manager.html"; } else{ window.location = "http://www.mysite.com/employee.html"; } </script>