Jump to content

Hastur

Caspio Guru
  • Posts

    142
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by Hastur

  1. Hello @gregbovenkerk! You may use the JS code to update the chart with custom Values for each week number of the year. I have found one web site to get the values for each week number - https://www.epochconverter.com/weeks/2020 Obviously, you will need to update the Array of custom values each year, but it works perfectly! See the example of the code: <script type="text/javascript"> var myVar = setInterval(myTimer, 1000); function myTimer() { if(Highcharts) { const customMonths = [ 'December 30, 2019', 'January 6, 2020', 'January 13, 2020', 'January 20, 2020', 'January 27, 2020', 'February 3, 2020', 'February 10, 2020', 'February 17, 2020', 'February 24, 2020', 'March 2, 2020', 'March 9, 2020', 'March 16, 2020', 'March 23, 2020', 'March 30, 2020', 'April 6, 2020', 'April 13, 2020', 'April 20, 2020', 'April 27, 2020', 'May 4, 2020', 'May 11, 2020', 'May 18, 2020', 'May 25, 2020', 'June 1, 2020', 'June 8, 2020', 'June 15, 2020', 'June 22, 2020', 'June 29, 2020', 'July 6, 2020', 'July 13, 2020', 'July 20, 2020', 'July 27, 2020', 'August 3, 2020', 'August 10, 2020', 'August 17, 2020', 'August 24, 2020', 'August 31, 2020', 'September 7, 2020', 'September 14, 2020', 'September 21, 2020', 'September 28, 2020', 'October 5, 2020', 'October 12, 2020', 'October 19, 2020', 'October 26, 2020', 'November 2, 2020', 'November 9, 2020', 'November 16, 2020', 'November 23, 2020', 'November 30, 2020', 'December 7, 2020', 'December 14, 2020', 'December 21, 2020', 'December 28, 2020' ]; Highcharts.charts[0].update({ xAxis: { categories: customMonths } }); myStopFunction(); } return null; } function myStopFunction() { clearInterval(myVar); } </script> You should insert this code into the header of the Chart page. Do not forget to disable the HTML editor before you insert the code!
  2. Hello @CMorris, You can try to add the "TOP 1" closure to the #inserted SELECT. Example:
  3. Hello @roattw I think this solution will not work with responsive. If you leave the open HTML tag in the HTML block with the responsive enabled, the tag will be closed automatically. But without responsive it still can work perfectly.
  4. Hello @mhand To implement such a workflow you may use JavaScript. Paste this code into the Header of the Submission form: <script type="text/javascript"> function inputHandler() { document.getElementById('InsertRecordTrxnType').value = document.getElementById('cbParamVirtual1').value //cbParamVirtual1 needs to be changed according to the name of the Virtual field you have in your DataPage } document.addEventListener('BeforeFormSubmit', inputHandler); </script> Note that cbParamVirtual1 needs to be changed according to the name of the Virtual field you have in your DataPage. Also, do not forget to Disable the HTML editor of the header in the advanced section.
  5. @Ed727 Hi! You may use the Grouping feature to group the repeating values and show them just once. Just check this article - https://howto.caspio.com/datapages/reports/advanced-reporting/data-grouping/ Hope this helps!!
  6. Hello @deemuss It is possible using additional JS code. You need to insert the following code into the Header of the Chart result section: <script type="text/javascript"> document.addEventListener('DataPageReady', chartUpdateHandler) function chartUpdateHandler(event) { var cleaner = function(interv) { clearInterval(interv); } let interv = setInterval(() => { if (!!Highcharts.charts[0]) { console.log(Highcharts.charts[0]); Highcharts.charts[0].update({ xAxis: { title: { margin: 100 //change this value to change the space } }, yAxis: { title: { margin: 100 //change this value to change the space } } }); cleaner(interv); } }, 200); } </script> Note that you need to disable the HTML editor of the Header in the Advanced section.
  7. Hi @deemuss You may use this code to implement such a workflow: <script type="text/javascript"> function inputHandler(event) { console.log(event); var options = event.target.childNodes var selectedOptions = ''; for(let i = 0; i < options.length; i++) { if (options[i].selected) { selectedOptions += `${options[i].value}, `; } } document.getElementById('cbParamVirtual1').value = selectedOptions.substring(0, selectedOptions.length - 2); // Here you may change the ID (cbParamVirtual) of needed input to insert the value of the choosen elements } function assignEvent() { var elem = document.getElementById('InsertRecordtext'); elem.multiple = true; elem.addEventListener('input', inputHandler); document.removeEventListener('DataPageReady', assignEvent); } document.addEventListener('DataPageReady', assignEvent); </script> You will have the option to multi-select elements from list box with ctrl button pressed. The only thing you need to change is the input to insert the chosen values. This code needs to be inserted into the header of the submission form. Do not forget to disable the HTML editor in the advanced section.
  8. I have the up to date version of this code which is friendly with AJAX loading of the datapages: <script type="text/javascript"> function customAlert() { alert ('Form was submitted'); } document.addEventListener('BeforeFormSubmit', customAlert); </script>
  9. @Leon13 I think that the best approach is to let your users to either expand all the groups or use the default option. To make it works, you need to add this code to the Footer of the Result set: <script type="text/javascript"> function customClick() { var elems = document.getElementsByClassName('cbResultSetShowHideGroupText'); for(let i = 0; i < elems.length; i++) { if(elems[i].children[0].alt === "expand icon") { elems[i].click(); } } } function assignEvent() { document.getElementById('expandAll').addEventListener('click', customClick); document.removeEventListener('DataPageReady', assignEvent); } document.addEventListener('DataPageReady', assignEvent); </script> And this code to the Header of the result set: <button id="expandAll">Expand All</button> Please note that you need to disable the HTML editor of the Header/Footer. You can make this in the Advanced section.
  10. @Thewf If you want to make API calls and not disclose the credentials, you should make this calls on the server side. So you need to have your own server with all the code related to the REST API calls. At the moment, there is no option to make calls directly from Caspio. The only exception is making calls using JS but it opens your credentials, which is unacceptable.
  11. @guardmetrics The only way to create the authentication using Caspio REST API is to store the passwords as the text data type, but not in the password data type In this case, you will be able to compare the values and set up the logic to authenticate the users. The biggest disadvantage is that the text data type is not encrypted as the Password field.
  12. @mgredmond Can you send me the Deploy URL of this datapage? You can send in private messages. I will check if it can be done using CSS
  13. @NickO I think, it is only possible using approach with 3 datapages
  14. Hello @randybow It is possible to implement such a workflow using additional JS code. You need to add Header/Footer to your chart and then insert the following snippets of code: HEADER <script type="text/javascript"> var myVar = setInterval(myTimer, 1000); function myTimer() { if(Highcharts) { const options = Highcharts.charts[0].series[0].yData; const result = options.reduce(function(accumulator, currentValue) {return accumulator + currentValue}); document.getElementById('total').innerHTML = 'Total: ' + result; myStopFunction(); } return null; } function myStopFunction() { clearInterval(myVar); } </script> FOOTER <h1 id="total"></h1> Please note that you need to disable the HTML editor both in the header and footer. You can do this in the advanced section.
  15. @Leon13 To make it clear, do you want to click just one button to expand all the collapsed groups?
  16. @CMorris You can implement such a trigger. Here you can find the example of the trigger and table design. As the trigger has a big size? i have divided print screen in two parts TABLES TRIGGER
  17. Hi @kpcollier As I can see, you use the Update DataPage. The N/A value is the current value of the field that you open in the Update Form. It means that currently you have no any value in the row. So you may leave it as it is or update with new value.
  18. Hi @JaredL As I know, there is no way to create such a calendar. But you can suggest such a feature in the IdeaBox - http://ideabox.caspio.com/forums/164206-caspio-bridge
  19. @Caspio101 It is better to check it in such a manner: if (strValue === "") { //... } OR if (strValue) { //... }
  20. Hi @OddbodsFuse Can you send the direct URL of your datapage? I need to check the CSS
  21. @LeftEar This formula concatenates the values of the fields within one row and skip the fields is there is no any value. If you have 64 blocks, you will need to have 64 CASE WHEN blocks.
  22. Hello @SDSteve You need to assign your custom events on DataPageReady custom event. First of all, make sure that your DataPage uses the AJAX loading. The AJAX checkbox should be unchecked. Then try using this code: <script type="text/javascript"> document.addEventListener('DataPageReady', customEvent); function customEvent() { document.getElementsByName("InsertRecordWC_MFG")[0].addEventListener("change", function() { console.log("I changed the manufacturer!"); document.getElementsByName("InsertRecordDRBI_YN")[0].value = "No"; document.getElementsByName("InsertRecordFR_YN")[0].value = "No"; document.getElementsByName("InsertRecordPERMIT_SUBMIT")[0].value = ""; }); document.getElementsByName("InsertRecordWC_MOD_OPT")[0].addEventListener("change", function() { console.log("I changed the model!"); document.getElementsByName("InsertRecordDRBI_YN")[0].value = "No"; document.getElementsByName("InsertRecordFR_YN")[0].value = "No"; document.getElementsByName("InsertRecordPERMIT_SUBMIT")[0].value = ""; }); } </script>
  23. Also, you may use the Formula Field on the Table level to concatenate values of the fields. Example of the formula for 3 fields: CASE WHEN Len([@field:bb]) = 0 THEN '' ELSE [@field:bb] + ', ' END + CASE WHEN Len([@field:cc]) = 0 THEN '' ELSE [@field:cc] + ', ' END + CASE WHEN Len([@field:dd]) = 0 THEN '' ELSE [@field:dd] END
  24. Hello @LeftEar Please make sure that your datapage use AJAX loading. The "Disable AJAX Loading" checkbox should be unchecked. Please try to use this code instead: <script type="text/javascript"> function concatenate() { var position1 = document.getElementsByName("InsertRecordPosition1")[0].value; var position2 = document.getElementsByName("InsertRecordPosition2")[0].value; var position3 = document.getElementsByName("InsertRecordPosition3")[0].value; var position4 = document.getElementsByName("InsertRecordPosition4")[0].value; var position5 = document.getElementsByName("InsertRecordPosition5")[0].value; var position6 = document.getElementsByName("InsertRecordPosition6")[0].value; var position7 = document.getElementsByName("InsertRecordPosition7")[0].value; var position8 = document.getElementsByName("InsertRecordPosition8")[0].value; var position9 = document.getElementsByName("InsertRecordPosition9")[0].value; var position10 = document.getElementsByName("InsertRecordPosition10")[0].value; var position11 = document.getElementsByName("InsertRecordPosition11")[0].value; var position12 = document.getElementsByName("InsertRecordPosition12")[0].value; var position13 = document.getElementsByName("InsertRecordPosition13")[0].value; var position14 = document.getElementsByName("InsertRecordPosition14")[0].value; var position15 = document.getElementsByName("InsertRecordPosition15")[0].value; var position16 = document.getElementsByName("InsertRecordPosition16")[0].value; var position17 = document.getElementsByName("InsertRecordPosition17")[0].value; var position18 = document.getElementsByName("InsertRecordPosition18")[0].value; var position19 = document.getElementsByName("InsertRecordPosition19")[0].value; var position20 = document.getElementsByName("InsertRecordPosition20")[0].value; var position21 = document.getElementsByName("InsertRecordPosition21")[0].value; var position22 = document.getElementsByName("InsertRecordPosition22")[0].value; var position23 = document.getElementsByName("InsertRecordPosition23")[0].value; var position24 = document.getElementsByName("InsertRecordPosition24")[0].value; var position25 = document.getElementsByName("InsertRecordPosition25")[0].value; var position26 = document.getElementsByName("InsertRecordPosition26")[0].value; var position27 = document.getElementsByName("InsertRecordPosition27")[0].value; var position28 = document.getElementsByName("InsertRecordPosition28")[0].value; var position29 = document.getElementsByName("InsertRecordPosition29")[0].value; var position30 = document.getElementsByName("InsertRecordPosition30")[0].value; var position31 = document.getElementsByName("InsertRecordPosition31")[0].value; var position32 = document.getElementsByName("InsertRecordPosition32")[0].value; var position33 = document.getElementsByName("InsertRecordPosition33")[0].value; var position34 = document.getElementsByName("InsertRecordPosition34")[0].value; var position35 = document.getElementsByName("InsertRecordPosition35")[0].value; var position36 = document.getElementsByName("InsertRecordPosition36")[0].value; var position37 = document.getElementsByName("InsertRecordPosition37")[0].value; var position38 = document.getElementsByName("InsertRecordPosition38")[0].value; var position39 = document.getElementsByName("InsertRecordPosition39")[0].value; var position40 = document.getElementsByName("InsertRecordPosition40")[0].value; var position41 = document.getElementsByName("InsertRecordPosition41")[0].value; var position42 = document.getElementsByName("InsertRecordPosition42")[0].value; var position43 = document.getElementsByName("InsertRecordPosition43")[0].value; var position44 = document.getElementsByName("InsertRecordPosition44")[0].value; var position45 = document.getElementsByName("InsertRecordPosition45")[0].value; var position46 = document.getElementsByName("InsertRecordPosition46")[0].value; var position47 = document.getElementsByName("InsertRecordPosition47")[0].value; var position48 = document.getElementsByName("InsertRecordPosition48")[0].value; var position49 = document.getElementsByName("InsertRecordPosition49")[0].value; var position50 = document.getElementsByName("InsertRecordPosition50")[0].value; var position51 = document.getElementsByName("InsertRecordPosition51")[0].value; var position52 = document.getElementsByName("InsertRecordPosition52")[0].value; var position53 = document.getElementsByName("InsertRecordPosition53")[0].value; var position54 = document.getElementsByName("InsertRecordPosition44")[0].value; var position55 = document.getElementsByName("InsertRecordPosition55")[0].value; var position56 = document.getElementsByName("InsertRecordPosition56")[0].value; var position57 = document.getElementsByName("InsertRecordPosition57")[0].value; var position58 = document.getElementsByName("InsertRecordPosition58")[0].value; var position59 = document.getElementsByName("InsertRecordPosition59")[0].value; var position60 = document.getElementsByName("InsertRecordPosition60")[0].value; var position61 = document.getElementsByName("InsertRecordPosition61")[0].value; var position62 = document.getElementsByName("InsertRecordPosition62")[0].value; var position63 = document.getElementsByName("InsertRecordPosition63")[0].value; var position64 = document.getElementsByName("InsertRecordPosition64")[0].value; var allpositions = position1 + ","+ position2 + ","+ position3 + ","+ position4 + ","+ position5 + ","+ position6 + ","+ position7 + ","+ position8 + ","+ position9 + ","+ position10 + ","+ position11 + ","+ position12 + ","+ position13 + ","+ position14 + ","+ position15 + ","+ position16 + ","+ position17 + ","+ position18 + ","+ position19 + ","+ position20 + ","+ position21 + ","+ position22 + ","+ position23 + ","+ position24 + ","+ position25 + ","+ position26 + ","+ position27 + ","+ position28 + ","+ position29 + ","+ position30 + ","+ position31 + ","+ position32 + ","+ position33 + ","+ position34 + ","+ position35 + ","+ position36 + ","+ position37 + ","+ position38 + ","+ position39 + ","+ position40 + ","+ position41 + ","+ position42 + ","+ position43 + ","+ position44 + ","+ position45 + ","+ position46 + ","+ position47 + ","+ position48 + ","+ position49 + ","+ position50 + ","+ position51 + ","+ position52 + ","+ position53 + ","+ position54 + ","+ position55 + ","+ position56 + ","+ position57 + ","+ position58 + ","+ position59 + ","+ position60 + ","+ position61 + ","+ position62 + ","+ position63 + ","+ position64; document.getElementsByName("InsertRecordAllPositions")[0].value = allpositions; } document.addEventListener('BeforeFormSubmit', concatenate); </script>
  25. Hi @Caspio101 You can implement this workflow using the JS code. Here is the code with comments on parts which needs to be changed according to your workflow: <style> /* some styles for the disabled button */ input[name="Submit"]:disabled { cursor: not-allowed !important; background-color: gray !important; } </style> <script type="text/javascript"> function inputHandler(event, elementsSelectors) { if (!!event.target.innerHTML.trim()) { let elements = elementsSelectors.map( function(selector) { return document.querySelector(selector).innerHTML.trim() }); if (elements.includes('0')) { // Here you may change the condition. Now the button will be disabled if at least one calc value is equal to 0 document.querySelector('input[name="Submit"]').disabled = true; } else { document.querySelector('input[name="Submit"]').disabled = false; } } else { return null; } } function assignEvent() { // here you may define the list of the selectors to choose calculated fields you may use in condition let elementsSelectors = ['span[id^="InsertRecordfield_1"]', 'span[id^="InsertRecordfield_2"]', 'span[id^="InsertRecordfield_3"]']; elementsSelectors.forEach(function(selector) { document.querySelector(selector).addEventListener('DOMSubtreeModified', function() { inputHandler(event, elementsSelectors); }); }); document.removeEventListener('DataPageReady', assignEvent); } document.addEventListener('DataPageReady', assignEvent); </script> You need to insert this code into the header of the submission form. Do not forget to disable the HTML editor in the advanced section of the header.
×
×
  • Create New...