Jump to content

ababcock

Caspio Ninja
  • Content Count

    50
  • Joined

  • Last visited

About ababcock

  • Rank
    Advanced Member

Recent Profile Visitors

419 profile views
  1. 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>
  2. I would also like to block negative amounts of time, for the reverse of this issue.
  3. 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>
  4. Sorry, I re-posted the first response initially as my response. Your solution worked, problem solved, thank you! Amanda
  5. That worked; thanks so much for your help! Amanda
  6. 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
  7. 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?
  8. 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?
  9. 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!!
  10. 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!
  11. 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!
  12. 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>
  13. Like this? Also not a JS expert -- just piecing it together as I go! <script>document.getElementById.value("cbParamVirtual1")</script>
  14. I have an HTML block in a submission form, and I'm trying to bring up some info based on the client selected. I created 10 virtual fields that use cascading dropdowns to retrieve this info. The virtual fields are hidden, and I am trying to show their results in an HTML block. Here is what I have come up with, but it's not showing the results on the deployed page. I checked the virtual fields, and they are bringing up the right information, so I must not be referencing it right in the HTML block. Does anyone know how to fix it? Thanks!! <div style="background:#e9e9e9;width: 300px"> <b>Potential contacts:</b><br /> <b>Case Manager:</b> <script>document.getElementById("cbParamVirtual1")</script> <b>Emergency Contact:</b> <script>document.getElementById("cbParamVirtual2")</script> <b>Physician:</b> <script>document.getElementById("cbParamVirtual3&";)</script> <b>Psychiatrist:</b> <script>document.getElementById("cbParamVirtual4")</script> <b>Therapist:</b> <script>document.getElementById("cbParamVirtual5")</script> <b>Advocate:</b> <script>document.getElementById("cbParamVirtual6")</script> <b>Pharmacy:</b> <script>document.getElementById("cbParamVirtual7")</script> <b>Employer:</b> <script>document.getElementById("cbParamVirtual8")</script> <b>Payee:</b> <script>document.getElementById("cbParamVirtual9")</script> <b>Guardian:</b> <script>document.getElementById("cbParamVirtual10")</script></div>
  15. I am trying to freeze a header on a Details page -- is there a way to adapt this to a Details page (rather than the results page)?
×
×
  • Create New...