Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by FaeFaeFae

  1. Hi @JKSGT! So are you saying that you are using a Submission Form to update the data in the existing record? You should probably use Single Record Update for this purpose, because Submission will always create a new record in the table. You can read more here: https://howto.caspio.com/datapages/forms/update-forms/ But I may have misunderstood you. So how do you exactly do that? What datapage type are you using for "amend"? If you give us more details, it will be much easier to help you.
  2. @Umbie I see what you are saying. Do you mean that ProductID field is set as UNIQUE on the table design tab? It is not enough to have unique values, you need to deliberately set the checkmark like this: I tried it with your table and the relationship type was recognized as One-to-Many. You may need to delete the existing relationship first before you convert the field to Unique, because otherwise the system won't let you save this change.
  3. Hi @Umbie! I'm not sure what you mean by saying "caspio does not recognize it". I tried importing both of your tables as is, without changing any data types and I was able to build the relationship between them. But what I find a little bit strange in your screenshot is that you are trying to relate "Product" field (which is the product name) with "Order Id" field. Looking at your tables I would say that the correct way is to establish the relationship between two ProductID fields. And, just in case, pay attention to the table at the very end of this article, that says "Compatible Data Types" to make sure in future that the two fields can be connected. https://howto.caspio.com/tables-and-views/relationships/
  4. @sfraden Do you do this on preview or via a deploy URL? That's really weird that it does not work for you. You can try the following to troubleshoot the situation. 1. Remove the auto-submission code and see if the redirection work when you do the manual submit. Before pressing Submit you could also open the Console in DevTools in your browser (F12 > Console) to see if there are any errors there (it could give us a hint what's going on) 2. Remove both auto-submit and redirection code, and inspect the page with the "Values in one or more fields are invalid" code. Try to enter the following in the console: document.querySelector('.cbFormCommonError'); and see if you can find this element in the page. 3. Double-check that the code was added to the correct submission form.
  5. Hey, @Fleshzombie! I wanted to add to the above solution. Below is a bit more effective way to sort the data by using HAVING instead of outer SELECT block. The solution above is good and it will work when inserting into a table, however when using a table variable with the query, you may encounter "Operand type clash" error. Try this:
  6. SeymourBots, I am not sure that this solution is exactly what you are looking for, but if you are going to embed your Caspio datapages into webpages elsewhere (e.g. using site builders like Wordpress), you could embed the submission form several times into the webpage. To get rid of repeating Submit buttons, you can use the approach from this topic: https://forums.caspio.com/topic/8044-submit-two-datapages-with-one-button/ By following these steps you will hide the repeating buttons and create a custom one to submit all the forms with one click. Here's the revised code for responsive datapages: To add to the Footer of the datapage: <script type="text/javascript"> document.addEventListener('DataPageReady', function () { document.querySelectorAll('div[class^="cbSubmitButtonContainer"').forEach(function(i) { i.style.display = "none"; }); }); </script> To add to the webpage where you ember the Submission Form: <button id="submitAll">Submit</button> <script> document.getElementById('submitAll').addEventListener('click', function() { var arr = Array.from(document.querySelectorAll('input[class^="cbSubmitButton"]')) arr.forEach(function(elem){ console.log(elem); elem.click(); }); }); </script> At least, you could give it a try
  7. Hi! I don't think there is a standard feature to do that here, but you can achieve this by re-directing users (on their first login) to a Single Record Update page or to a Forgot Password page. Check this topic https://forums.caspio.com/topic/7430-change-password-on-first-login/ It's the same request they're discussing, I guess.
  8. Try this code instead: <script type="text/javascript"> if(document.querySelector('.cbFormCommonError')){ window.location.href = "https://c1acyXXX.caspio.com/dp/48c0900099f0e199ea0043c3XXXX"; } </script> You need to add it to the footer of the Submission Form that gets auto-submitted.
  9. That's a bit more tricky. Please try the solution below: 1. Remove styles from Header. 2. Add the following script to Footer: <script type="text/javascript"> document.addEventListener('DataPageReady', chartUpdateHandler); function chartUpdateHandler(event) { var cleaner = function(interv) { clearInterval(interv); } let interv = setInterval(() => { if (!!Highcharts) { const options = Highcharts.charts[0].series[0].data; var lastName = options[options.length-1].name; var secondLastName = options[options.length-2].name; let data = []; options.forEach(option => { let localData = {}; localData.y = option.y; localData.name = option.name; if(options.length >= 6){ if(option.name === lastName) { localData.color = '#13B5EA'; }else if(option.name === secondLastName){ localData.color = '#ffb32b'; } } else { if(option.name === lastName){ localData.color = '#13B5EA'; } } data.push(localData); }); Highcharts.charts[0].update({ series: { data: data } }); cleaner(interv); } }, 200); } </script> What the script will do is: if there are 6 or more columns, then the last two will be colored; if there are less than 6 columns, then only the last one will be colored.
  10. Hi! Try using :last-child and :nth-last-child(2) instead of :nth-child <style> rect.highcharts-point.highcharts-color-0:nth-last-child(2) { fill: #ffb32b; } rect.highcharts-point.highcharts-color-0:last-child { fill: #13B5EA; } </style>
  11. Here is an interesting thing. I've had a slightly different case. If you want AT LEASET ONE of the fields to be not zero and only prevent submission when all of them are zero, then you only need to modify one line of the code. Change: if (elements.includes('0')) { to: if (elements.every(function(el){ return el == 0})){
  12. Just in case somebody prefers JS over rules, you can try the following code too. You need to add Header&Footer for your DataPage Elements and paste this to the Footer (with HTML Editor disabled on the Advanced tab). This code will also hide all of the 8 fields until something is selected from the dropdown. If you want them all to be initially shown, just remove the 2 lines that say "//hide all fields on page load''. <script type="text/javascript"> function hide(fields){ fields.forEach(el => el.style.cssText = "display: none;"); } document.addEventListener('DataPageReady', function (event) { var employeeFields = Array.from(document.querySelectorAll('[id^="InsertRecordEmployee"]')); var employeeLabels = Array.from(document.querySelectorAll('label[for^="InsertRecordEmployee"]')); hide(employeeFields); //hide all fields on page load hide(employeeLabels); //hide all fields on page load document.getElementById("cbParamVirtual1").onchange= function(){ hide(employeeFields); hide(employeeLabels); var num = document.getElementById("cbParamVirtual1").value; for (let i = 0; i < num; i++){ employeeFields[i].style.cssText = "display: inline-block;"; employeeLabels[i].style.cssText = "display: inline-block;"; } } }); </script> Note: ('[id^="InsertRecordEmployee"]')) ('label[for^="InsertRecordEmployee"]')) Here, "Employee" is the beginning of the database field names (like Employee1, Employee2 etc) so it should match your table design.
  • Create New...